home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / DIKUMUD.ZIP / ACT_INFO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-28  |  76.5 KB  |  2,925 lines

  1. /* ************************************************************************
  2.  *  file: act.informative.c , Implementation of commands.  Part of DIKUMUD *
  3.  *  Usage : Informative commands.                                          *
  4.  *  Copyright (C) 1990, 1991 - see 'license.doc' for complete information. *
  5.  ************************************************************************* */
  6.  
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <ctype.h>
  10. #include <time.h>
  11.  
  12. #include "protos.h"
  13.  
  14. /* extern variables */
  15. #if HASH
  16. extern struct hash_header room_db;
  17. #else
  18. extern struct room_data *room_db;
  19. #endif
  20. extern struct descriptor_data *descriptor_list;
  21. extern struct char_data *character_list;
  22. extern struct obj_data *object_list;
  23.  
  24. extern int  top_of_world;
  25. extern int  top_of_zone_table;
  26. extern int  top_of_mobt;
  27. extern int  top_of_objt;
  28. extern int  top_of_p_table;
  29.  
  30. extern char credits[MAX_STRING_LENGTH];
  31. extern char news[MAX_STRING_LENGTH];
  32. extern char info[MAX_STRING_LENGTH];
  33. extern char wizlist[MAX_STRING_LENGTH];
  34. extern char *dirs[]; 
  35. extern char *where[];
  36. extern char *color_liquid[];
  37. extern char *fullness[];
  38. extern const char *RaceName[];
  39. extern const int RacialMax[][6];
  40. extern char *spell_desc[];
  41. extern char *spells[];
  42. /* extern functions */
  43.  
  44. struct time_info_data age(struct char_data *ch);
  45. void page_string(struct descriptor_data *d, char *str, int keep_internal);
  46. int track( struct char_data *ch, struct char_data *vict);
  47. int GetApprox(int num, int perc);
  48. int SpyCheck(struct char_data *ch);
  49. int remove_trap( struct char_data *ch, struct obj_data *trap);
  50.  
  51. struct obj_data *get_obj_in_list_vis(struct char_data *ch, char *name, 
  52.                      struct obj_data *list);
  53.  
  54.  
  55. /* intern functions */
  56.  
  57. void list_obj_to_char(struct obj_data *list,struct char_data *ch, int mode,
  58.               bool show);
  59. char *DescDamage(float dam);
  60. char *DescRatio(float f);  /* theirs / yours */
  61. char *DamRollDesc(int a);
  62. char *HitRollDesc(int a);
  63. char *ArmorDesc(int a);
  64. char *AlignDesc(int a);
  65. char *DescAttacks(float a);
  66.  
  67.  
  68. int singular( struct obj_data *o)
  69. {
  70.  
  71.   if (IS_SET(o->obj_flags.wear_flags, ITEM_WEAR_HANDS) ||
  72.       IS_SET(o->obj_flags.wear_flags, ITEM_WEAR_FEET) ||
  73.       IS_SET(o->obj_flags.wear_flags, ITEM_WEAR_LEGS) ||
  74.       IS_SET(o->obj_flags.wear_flags, ITEM_WEAR_ARMS))
  75.     return(FALSE);
  76.   return(TRUE);
  77. }
  78.  
  79. /* Procedures related to 'look' */
  80.  
  81. void argument_split_2(char *argument, char *first_arg, char *second_arg) {
  82.   int look_at, begin;
  83.   begin = 0;
  84.   
  85.   /* Find first non blank */
  86.   for ( ;*(argument + begin ) == ' ' ; begin++);
  87.   
  88.   /* Find length of first word */
  89.   for (look_at=0; *(argument+begin+look_at) > ' ' ; look_at++)
  90.     
  91.     /* Make all letters lower case, AND copy them to first_arg */
  92.     *(first_arg + look_at) = LOWER(*(argument + begin + look_at));
  93.   *(first_arg + look_at) = '\0';
  94.   begin += look_at;
  95.   
  96.   /* Find first non blank */
  97.   for ( ;*(argument + begin ) == ' ' ; begin++);
  98.   
  99.   /* Find length of second word */
  100.   for ( look_at=0; *(argument+begin+look_at)> ' ' ; look_at++)
  101.     
  102.     /* Make all letters lower case, AND copy them to second_arg */
  103.     *(second_arg + look_at) = LOWER(*(argument + begin + look_at));
  104.   *(second_arg + look_at)='\0';
  105.   begin += look_at;
  106. }
  107.  
  108. struct obj_data *get_object_in_equip_vis(struct char_data *ch,
  109.                 char *arg, struct obj_data *equipment[], int *j) {
  110.   
  111.   for ((*j) = 0; (*j) < MAX_WEAR ; (*j)++)
  112.     if (equipment[(*j)])
  113.       if (CAN_SEE_OBJ(ch,equipment[(*j)]))
  114.     if (isname(arg, equipment[(*j)]->name))
  115.       return(equipment[(*j)]);
  116.   
  117.   return (0);
  118. }
  119.  
  120. char *find_ex_description(char *word, struct extra_descr_data *list)
  121. {
  122.   struct extra_descr_data *i;
  123.   
  124.   for (i = list; i; i = i->next)
  125.     if (isname(word,i->keyword))
  126.       return(i->description);
  127.   
  128.   return(0);
  129. }
  130.  
  131.  
  132. void show_obj_to_char(struct obj_data *object, struct char_data *ch, int mode)
  133. {
  134.   char buffer[MAX_STRING_LENGTH];
  135.   
  136.   buffer[0] = 0;
  137.   if ((mode == 0) && object->description)
  138.     strcpy(buffer, object->description);        
  139.   else if (object->short_description && ((mode == 1) ||
  140.                      (mode == 2) || (mode==3) || (mode == 4))) 
  141.     strcpy(buffer,object->short_description);
  142.   else if (mode == 5) {
  143.     if (object->obj_flags.type_flag == ITEM_NOTE)      {
  144.       if (object->action_description)     {
  145.     strcpy(buffer, "There is something written upon it:\n\r\n\r");
  146.     strcat(buffer, object->action_description);
  147.     page_string(ch->desc, buffer, 1);
  148.       }  else {
  149.     act("It's blank.", FALSE, ch,0,0,TO_CHAR);
  150.       }
  151.     } else if((object->obj_flags.type_flag != ITEM_DRINKCON)) {
  152.       strcpy(buffer,"You see nothing special..");
  153.     }  else  { /* ITEM_TYPE == ITEM_DRINKCON */
  154.       strcpy(buffer, "It looks like a drink container.");
  155.     }
  156.   }
  157.   
  158.   if (mode != 3) { 
  159.     if (IS_OBJ_STAT(object,ITEM_INVISIBLE)) {
  160.       strcat(buffer,"(invisible)");
  161.     }
  162.     if (IS_OBJ_STAT(object,ITEM_ANTI_GOOD) && 
  163.     IS_AFFECTED(ch,AFF_DETECT_EVIL)) {
  164.       if (singular(object))
  165.     strcat(buffer,"..It glows red");
  166.       else 
  167.     strcat(buffer,"..They glow red");
  168.     }
  169.     if (IS_OBJ_STAT(object,ITEM_MAGIC) && IS_AFFECTED(ch,AFF_DETECT_MAGIC)) {
  170.       if (singular(object))
  171.     strcat(buffer,"..It glows blue");
  172.       else 
  173.     strcat(buffer,"..They glow blue");
  174.     }
  175.     if (IS_OBJ_STAT(object,ITEM_GLOW)) {
  176.       if (singular(object))
  177.     strcat(buffer,"..It glows softly");
  178.       else 
  179.     strcat(buffer,"..They glow softly");
  180.     }
  181.     if (IS_OBJ_STAT(object,ITEM_HUM)) {
  182.       if (singular(object))
  183.       strcat(buffer,"..It hums powerfully");
  184.       else 
  185.     strcat(buffer,"..They hum with power");
  186.     }
  187.     if (object->obj_flags.type_flag == ITEM_ARMOR) {
  188.       if (object->obj_flags.value[0] <
  189.       (object->obj_flags.value[1] / 4)) {
  190.     if (singular(object))
  191.       strcat(buffer, "..It is falling apart");
  192.     else 
  193.       strcat(buffer,"..They are falling apart");
  194.       } else if (object->obj_flags.value[0] < 
  195.          (object->obj_flags.value[1] / 3)) {
  196.     if (singular(object))
  197.       strcat(buffer, "..It is need of much repair.");
  198.     else 
  199.       strcat(buffer,"..They are in need of much repair");
  200.       } else if (object->obj_flags.value[0] < 
  201.          (object->obj_flags.value[1] / 2)) {
  202.     if (singular(object))
  203.       strcat(buffer, "..It is in fair condition");
  204.     else 
  205.       strcat(buffer,"..They are in fair condition");
  206.       } else if  (object->obj_flags.value[0] < 
  207.           object->obj_flags.value[1]) {
  208.     if (singular(object))
  209.       strcat(buffer, "..It is in good condition");
  210.     else 
  211.       strcat(buffer,"..They are in good condition");
  212.       } else {
  213.     if (singular(object))
  214.       strcat(buffer, "..It is in excellent condition");
  215.     else 
  216.       strcat(buffer,"..They are in excellent condition");
  217.       }
  218.     }
  219.   }
  220.   
  221.   
  222.   strcat(buffer, "\n\r");
  223.   page_string(ch->desc, buffer, 1);
  224.   
  225. }
  226.  
  227. void show_mult_obj_to_char(struct obj_data *object, struct char_data *ch, int mode, int num)
  228. {
  229.   char buffer[MAX_STRING_LENGTH];
  230.   char tmp[10];
  231.  
  232.   buffer[0] = 0;
  233.   tmp[0] = 0;
  234.   
  235.   if ((mode == 0) && object->description)
  236.     strcpy(buffer,object->description);
  237.   else     if (object->short_description && ((mode == 1) ||
  238.                       (mode == 2) || (mode==3) || (mode == 4))) 
  239.     strcpy(buffer,object->short_description);
  240.   else if (mode == 5) {
  241.     if (object->obj_flags.type_flag == ITEM_NOTE)      {
  242.       if (object->action_description)     {
  243.     strcpy(buffer, "There is something written upon it:\n\r\n\r");
  244.     strcat(buffer, object->action_description);
  245.     page_string(ch->desc, buffer, 1);
  246.       }  else
  247.     act("It's blank.", FALSE, ch,0,0,TO_CHAR);
  248.       return;
  249.     } else if((object->obj_flags.type_flag != ITEM_DRINKCON)) {
  250.       strcpy(buffer,"You see nothing special..");
  251.     }  else  { /* ITEM_TYPE == ITEM_DRINKCON */
  252.       strcpy(buffer, "It looks like a drink container.");
  253.     }
  254.   }
  255.   
  256.   if (mode != 3) { 
  257.     if (IS_OBJ_STAT(object,ITEM_INVISIBLE)) {
  258.       strcat(buffer,"(invisible)");
  259.     }
  260.     if (IS_OBJ_STAT(object,ITEM_ANTI_GOOD) && 
  261.     IS_AFFECTED(ch,AFF_DETECT_EVIL)) {
  262.       strcat(buffer,"..It glows red!");
  263.     }
  264.     if (IS_OBJ_STAT(object,ITEM_MAGIC) && IS_AFFECTED(ch,AFF_DETECT_MAGIC)) {
  265.       strcat(buffer,"..It glows blue!");
  266.     }
  267.     if (IS_OBJ_STAT(object,ITEM_GLOW)) {
  268.       strcat(buffer,"..It has a soft glowing aura!");
  269.     }
  270.     if (IS_OBJ_STAT(object,ITEM_HUM)) {
  271.       strcat(buffer,"..It emits a faint humming sound!");
  272.     }
  273.   }
  274.   
  275.   if (num>1) {
  276.     sprintf(tmp,"[%d]", num);
  277.     strcat(buffer, tmp);
  278.   }
  279.   strcat(buffer, "\n\r");
  280.   page_string(ch->desc, buffer, 1);
  281. }
  282.  
  283. void list_obj_in_room(struct obj_data *list, struct char_data *ch)
  284. {
  285.   struct obj_data *i, *cond_ptr[50];
  286.   int Inventory_Num = 1, num;
  287.   int k, cond_top, cond_tot[50], found=FALSE;
  288.   char buf[MAX_STRING_LENGTH];
  289.   
  290.   cond_top = 0; 
  291.   
  292.   for (i=list; i; i = i->next_content) {
  293.     if (CAN_SEE_OBJ(ch, i)) {
  294.       if (cond_top< 50) {
  295.     found = FALSE;
  296.     for (k=0;(k<cond_top&& !found);k++) {
  297.       if (cond_top>0) {
  298.         if ((i->item_number == cond_ptr[k]->item_number) &&
  299.         (i->description && cond_ptr[k]->description &&
  300.          !strcmp(i->description,cond_ptr[k]->description))){
  301.           cond_tot[k] += 1;
  302.           found=TRUE;
  303.         }
  304.       }          
  305.     }
  306.     if (!found) {
  307.       cond_ptr[cond_top] = i;
  308.       cond_tot[cond_top] = 1;
  309.       cond_top+=1;
  310.     }
  311.       } else {
  312.     if ((ITEM_TYPE(i) == ITEM_TRAP) || (GET_TRAP_CHARGES(i) > 0)) {
  313.              num = number(1,100);
  314.              if (ch->skills && num < (ch->skills[SKILL_FIND_TRAP].learned/2)) {
  315.         show_obj_to_char(i,ch,0);
  316.       }
  317.         } else {
  318.       show_obj_to_char(i,ch,0);      
  319.     }
  320.       }
  321.     }
  322.   }
  323.   
  324.   if (cond_top) {
  325.     for (k=0; k<cond_top; k++) {
  326.       if ((ITEM_TYPE(cond_ptr[k]) == ITEM_TRAP) && 
  327.       (GET_TRAP_CHARGES(cond_ptr[k]) > 0)) {
  328.     num = number(1,101);
  329.     if (ch->skills && (num < (ch->skills[SKILL_FIND_TRAP].learned/2)))
  330.       if (cond_tot[k] > 1) {
  331.         sprintf(buf,"[%2d] ",Inventory_Num++);
  332.         send_to_char(buf,ch);
  333.         show_mult_obj_to_char(cond_ptr[k],ch,0,cond_tot[k]);
  334.       } else {
  335.         show_obj_to_char(cond_ptr[k],ch,0);
  336.       }
  337.       } else {
  338.     if (cond_tot[k] > 1) {
  339.       sprintf(buf,"[%2d] ",Inventory_Num++);
  340.       send_to_char(buf,ch);
  341.       show_mult_obj_to_char(cond_ptr[k],ch,0,cond_tot[k]);
  342.     } else {
  343.       show_obj_to_char(cond_ptr[k],ch,0);
  344.     }
  345.       }
  346.     }
  347.   }
  348. }
  349.  
  350. void list_obj_in_heap(struct obj_data *list, struct char_data *ch)
  351. {
  352.   struct obj_data *i, *cond_ptr[50];
  353.   int k, cond_top, cond_tot[50], found=FALSE;  
  354.   char buf[MAX_STRING_LENGTH];
  355.   
  356.   int Num_Inventory = 1;
  357.   cond_top = 0; 
  358.   
  359.   for (i=list; i; i = i->next_content) {
  360.     if (CAN_SEE_OBJ(ch, i)) {
  361.       if (cond_top< 50) {
  362.     found = FALSE;
  363.         for (k=0;(k<cond_top&& !found);k++) {
  364.           if (cond_top>0) {
  365.             if ((i->item_number == cond_ptr[k]->item_number) &&
  366.         (i->short_description && cond_ptr[k]->short_description &&
  367.          (!strcmp(i->short_description,cond_ptr[k]->short_description)))){
  368.           cond_tot[k] += 1;
  369.           found=TRUE;
  370.         }
  371.       }        
  372.     }
  373.     if (!found) {
  374.       cond_ptr[cond_top] = i;
  375.       cond_tot[cond_top] = 1;
  376.       cond_top+=1;
  377.     }
  378.       } else {
  379.     show_obj_to_char(i,ch,2);
  380.       }
  381.     }
  382.   }
  383.   
  384.   if (cond_top) {
  385.     for (k=0; k<cond_top; k++) {
  386.       sprintf(buf,"[%2d] ",Num_Inventory++);
  387.       send_to_char(buf,ch);
  388.       if (cond_tot[k] > 1) {
  389.     Num_Inventory += cond_tot[k] - 1;
  390.     show_mult_obj_to_char(cond_ptr[k],ch,2,cond_tot[k]);
  391.       } else {
  392.     show_obj_to_char(cond_ptr[k],ch,2);
  393.       }    
  394.     }
  395.   }
  396. }
  397.  
  398. void list_obj_to_char(struct obj_data *list,struct char_data *ch, int mode, 
  399.               bool show) {
  400.   char buf[MAX_STRING_LENGTH];
  401.   int Num_In_Bag = 1;
  402.   struct obj_data *i;
  403.   bool found;
  404.   
  405.   found = FALSE;
  406.   for ( i = list ; i ; i = i->next_content ) { 
  407.     if (CAN_SEE_OBJ(ch,i)) {
  408.       sprintf(buf,"[%2d] ",Num_In_Bag++);
  409.       send_to_char(buf,ch);
  410.       show_obj_to_char(i, ch, mode);
  411.       found = TRUE;
  412.     }    
  413.   }  
  414.   if ((! found) && (show)) send_to_char("Nothing\n\r", ch);
  415. }
  416.  
  417.  
  418.  
  419. void show_char_to_char(struct char_data *i, struct char_data *ch, int mode)
  420. {
  421.   char buffer[MAX_STRING_LENGTH];
  422.   int j, found, percent, otype;
  423.   struct obj_data *tmp_obj;
  424.   struct affected_type *aff;
  425.   
  426.   
  427.   if (mode == 0) {
  428.     
  429.     if (IS_AFFECTED(i, AFF_HIDE) || !CAN_SEE(ch,i)) {
  430.       if (IS_AFFECTED(ch, AFF_SENSE_LIFE))
  431.     send_to_char("You sense a hidden life form in the room.\n\r", ch);
  432.       return;
  433.     }
  434.     
  435.     if (!(i->player.long_descr)||(GET_POS(i) != i->specials.default_pos)){
  436.       /* A player char or a mobile without long descr, or not in default pos.*/
  437.       if (!IS_NPC(i)) {    
  438.     strcpy(buffer,GET_NAME(i));
  439.     strcat(buffer," ");
  440.     if (GET_TITLE(i))
  441.       strcat(buffer,GET_TITLE(i));
  442.       } else {
  443.     strcpy(buffer, i->player.short_descr);
  444.     CAP(buffer);
  445.       }
  446.       
  447.       if ( IS_AFFECTED(i,AFF_INVISIBLE) || i->invis_level == LOW_IMMORTAL)
  448.     strcat(buffer," (invisible)");
  449.       if ( IS_AFFECTED(i,AFF_CHARM))
  450.     strcat(buffer," (pet)");
  451.       
  452.       switch(GET_POS(i)) {
  453.       case POSITION_STUNNED  : 
  454.     strcat(buffer," is lying here, stunned."); break;
  455.       case POSITION_INCAP    : 
  456.     strcat(buffer," is lying here, incapacitated."); break;
  457.       case POSITION_MORTALLYW: 
  458.     strcat(buffer," is lying here, mortally wounded."); break;
  459.       case POSITION_DEAD     : 
  460.     strcat(buffer," is lying here, dead."); break;
  461.       case POSITION_MOUNTED:
  462.     if (MOUNTED(i)) {
  463.       strcat(buffer, " is here, riding ");
  464.       strcat(buffer, MOUNTED(i)->player.short_descr);
  465.     } else {
  466.       strcat(buffer, " is standing here.");
  467.     }
  468.     break;
  469.       case POSITION_STANDING : 
  470.     if (!IS_AFFECTED(i, AFF_FLYING)) {
  471.       if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  472.         strcat(buffer, "is floating here.");
  473.       else
  474.         strcat(buffer," is standing here."); 
  475.     } else {
  476.       strcat(buffer," is flying about.");
  477.     }
  478.     break;
  479.       case POSITION_SITTING  : 
  480.     if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  481.       strcat(buffer, "is floating here.");
  482.     else
  483.       strcat(buffer," is sitting here.");  break;
  484.       case POSITION_RESTING  : 
  485.     if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  486.       strcat(buffer, "is resting here in the water.");
  487.     else
  488.     strcat(buffer," is resting here.");  break;
  489.       case POSITION_SLEEPING : 
  490.     if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  491.       strcat(buffer, "is sleeping here in the water.");
  492.     else
  493.     strcat(buffer," is sleeping here."); break;
  494.       case POSITION_FIGHTING :
  495.     if (i->specials.fighting) {
  496.       
  497.       strcat(buffer," is here, fighting ");
  498.       if (i->specials.fighting == ch)
  499.         strcat(buffer," YOU!");
  500.       else {
  501.         if (i->in_room == i->specials.fighting->in_room)
  502.           if (IS_NPC(i->specials.fighting))
  503.         strcat(buffer, i->specials.fighting->player.short_descr);
  504.           else
  505.         strcat(buffer, GET_NAME(i->specials.fighting));
  506.         else
  507.           strcat(buffer, "someone who has already left.");
  508.       }
  509.     } else /* NIL fighting pointer */
  510.       strcat(buffer," is here struggling with thin air.");
  511.     break;
  512.     default : strcat(buffer," is floating here."); break;
  513.       }
  514.       if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
  515.     if (IS_EVIL(i))
  516.       strcat(buffer, " (Red Aura)");
  517.       }
  518.       
  519.       strcat(buffer,"\n\r");
  520.       send_to_char(buffer, ch);
  521.     } else {  /* npc with long */
  522.       
  523.       if (IS_AFFECTED(i,AFF_INVISIBLE))
  524.     strcpy(buffer,"*");
  525.       else
  526.     *buffer = '\0';
  527.       
  528.       if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
  529.     if (IS_EVIL(i))
  530.       strcat(buffer, " (Red Aura)");
  531.       }
  532.       
  533.       strcat(buffer, i->player.long_descr);
  534.       
  535.       send_to_char(buffer, ch);
  536.     }
  537.     
  538.     if (IS_AFFECTED(i,AFF_SANCTUARY))
  539.       act("$n glows with a bright light!", FALSE, i, 0, ch, TO_VICT);
  540.     if (IS_AFFECTED(i,AFF_GROWTH))
  541.       act("$n is extremely large!", FALSE, i, 0, ch, TO_VICT);
  542.     if (IS_AFFECTED(i, AFF_FIRESHIELD)) 
  543.       act("$n is surrounded by burning flames!", FALSE, i, 0, ch, TO_VICT);
  544.     
  545.   } else if (mode == 1) {
  546.     
  547.     if (i->player.description)
  548.       send_to_char(i->player.description, ch);
  549.     else {
  550.       act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);
  551.     }
  552.  
  553. /*
  554.   personal descriptions.
  555. */
  556.  
  557.     if (IS_PC(i)) {
  558.     sprintf(buffer, "$n is %s", RaceName[GET_RACE(i)]);
  559.     act(buffer, FALSE, i, 0, ch, TO_VICT);    
  560.     }
  561.  
  562.     if (MOUNTED(i)) {
  563.       sprintf(buffer,"$n is mounted on %s", MOUNTED(i)->player.short_descr);
  564.       act(buffer, FALSE, i, 0, ch, TO_VICT);
  565.     }
  566.     
  567.     if (RIDDEN(i)) {
  568.       sprintf(buffer,"$n is ridden by %s", IS_NPC(RIDDEN(i))?RIDDEN(i)->player.short_descr:GET_NAME(RIDDEN(i)));
  569.       act(buffer, FALSE, i, 0, ch, TO_VICT);
  570.     }
  571.  
  572.     /* Show a character to another */
  573.     
  574.     if (GET_MAX_HIT(i) > 0)
  575.       percent = (100*GET_HIT(i))/GET_MAX_HIT(i);
  576.     else
  577.       percent = -1; /* How could MAX_HIT be < 1?? */
  578.     
  579.     if (IS_NPC(i))
  580.       strcpy(buffer, i->player.short_descr);
  581.     else
  582.       strcpy(buffer, GET_NAME(i));
  583.     
  584.     if (percent >= 100)
  585.       strcat(buffer, " is in an excellent condition.\n\r");
  586.     else if (percent >= 90)
  587.       strcat(buffer, " has a few scratches.\n\r");
  588.     else if (percent >= 75)
  589.       strcat(buffer, " has some small wounds and many bruises.\n\r");
  590.     else if (percent >= 50)
  591.       strcat(buffer, " is wounded, and bleeding.\n\r");
  592.     else if (percent >= 30)
  593.       strcat(buffer, " has some big nasty wounds and scratches.\n\r");
  594.     else if (percent >= 15)
  595.       strcat(buffer, " is badly wounded\n\r");
  596.     else if (percent >= 0)
  597.       strcat(buffer, " is in an awful condition.\n\r");
  598.     else
  599.       strcat(buffer, " is bleeding badly from large, gaping wounds.\n\r");
  600.     
  601.     send_to_char(buffer, ch);
  602.  
  603.  
  604. /*
  605.   spell_descriptions, etc.
  606. */
  607.     for (aff = i->affected; aff; aff = aff->next) {
  608.       if (aff->type < 170) {
  609.     otype = -1;
  610.     if (spell_desc[aff->type] && *spell_desc[aff->type])
  611.       if (aff->type != otype) {
  612.         act(spell_desc[aff->type], FALSE, i, 0, ch, TO_VICT);
  613.         otype = aff->type;
  614.       }
  615.       }
  616.     }
  617.  
  618.     
  619.     found = FALSE;
  620.     for (j=0; j< MAX_WEAR; j++) {
  621.       if (i->equipment[j]) {
  622.     if (CAN_SEE_OBJ(ch,i->equipment[j])) {
  623.       found = TRUE;
  624.     }
  625.       }
  626.     }
  627.     if (found) {
  628.       act("\n\r$n is using:", FALSE, i, 0, ch, TO_VICT);
  629.       for (j=0; j< MAX_WEAR; j++) {
  630.     if (i->equipment[j]) {
  631.       if (CAN_SEE_OBJ(ch,i->equipment[j])) {
  632.         send_to_char(where[j],ch);
  633.         show_obj_to_char(i->equipment[j],ch,1);
  634.       }
  635.     }
  636.       }
  637.     }
  638.     if (HasClass(ch, CLASS_THIEF) && (ch != i) &&
  639.     (!IS_IMMORTAL(ch))){
  640.       found = FALSE;
  641.       send_to_char
  642.     ("\n\rYou attempt to peek at the inventory:\n\r", ch);
  643.       for(tmp_obj = i->carrying; tmp_obj; 
  644.       tmp_obj = tmp_obj->next_content) {
  645.     if (CAN_SEE_OBJ(ch, tmp_obj) && 
  646.         (number(0,MAX_MORT) < GetMaxLevel(ch))) {
  647.       show_obj_to_char(tmp_obj, ch, 1);
  648.       found = TRUE;
  649.     }
  650.       }
  651.       if (!found)
  652.     send_to_char("You can't see anything.\n\r", ch);
  653.     } else if (IS_IMMORTAL(ch)) {
  654.       send_to_char("Inventory:\n\r",ch);
  655.       for(tmp_obj = i->carrying; tmp_obj; 
  656.       tmp_obj = tmp_obj->next_content) {
  657.     show_obj_to_char(tmp_obj, ch, 1);
  658.     found = TRUE;
  659.       }
  660.       if (!found) {
  661.     send_to_char("Nothing\n\r",ch);
  662.       }
  663.     }
  664.     
  665.   } else if (mode == 2) {
  666.     
  667.     /* Lists inventory */
  668.     act("$n is carrying:", FALSE, i, 0, ch, TO_VICT);
  669.     list_obj_in_heap(i->carrying,ch);
  670.   }
  671. }
  672.  
  673.  
  674. void show_mult_char_to_char(struct char_data *i, struct char_data *ch, int mode, int num)
  675. {
  676.   char buffer[MAX_STRING_LENGTH];
  677.   char tmp[10];
  678.   int j, found, percent;
  679.   struct obj_data *tmp_obj;
  680.   
  681.   if (mode == 0) {
  682.     if (IS_AFFECTED(i, AFF_HIDE) || !CAN_SEE(ch,i)) {
  683.       if (IS_AFFECTED(ch, AFF_SENSE_LIFE))
  684.     if (num==1)
  685.       send_to_char("You sense a hidden life form in the room.\n\r", ch);
  686.     else 
  687.       send_to_char("You sense hidden life forma in the room.\n\r", ch);        
  688.       return;
  689.     }
  690.     
  691.     if (!(i->player.long_descr)||(GET_POS(i) != i->specials.default_pos)){
  692.       /* A player char or a mobile without long descr, or not in default pos. */
  693.       if (!IS_NPC(i)) {    
  694.     strcpy(buffer,GET_NAME(i));
  695.     strcat(buffer," ");
  696.     if (GET_TITLE(i))
  697.       strcat(buffer,GET_TITLE(i));
  698.       } else {
  699.     strcpy(buffer, i->player.short_descr);
  700.     CAP(buffer);
  701.       }
  702.       
  703.       if ( IS_AFFECTED(i,AFF_INVISIBLE))
  704.     strcat(buffer," (invisible)");
  705.       if ( IS_AFFECTED(i,AFF_CHARM))
  706.     strcat(buffer," (pet)");
  707.       
  708.       switch(GET_POS(i)) {
  709.       case POSITION_STUNNED  : 
  710.     strcat(buffer," is lying here, stunned."); break;
  711.       case POSITION_INCAP    : 
  712.     strcat(buffer," is lying here, incapacitated."); break;
  713.       case POSITION_MORTALLYW: 
  714.     strcat(buffer," is lying here, mortally wounded."); break;
  715.       case POSITION_DEAD     : 
  716.     strcat(buffer," is lying here, dead."); break;
  717.       case POSITION_STANDING : 
  718.     if (!IS_AFFECTED(i, AFF_FLYING)) {
  719.       if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  720.         strcat(buffer, "is floating here.");
  721.       else
  722.         strcat(buffer," is standing here."); 
  723.     } else {
  724.       strcat(buffer," is flying about.");
  725.     }
  726.     break;
  727.       case POSITION_SITTING  : 
  728.     if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  729.       strcat(buffer, "is floating here.");
  730.     else
  731.       strcat(buffer," is sitting here.");  break;
  732.       case POSITION_RESTING  : 
  733.     if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  734.       strcat(buffer, "is resting here in the water");
  735.     else
  736.       strcat(buffer," is resting here.");  break;
  737.       case POSITION_SLEEPING : 
  738.     if (real_roomp(i->in_room)->sector_type == SECT_WATER_NOSWIM)
  739.       strcat(buffer, "is sleeping here in the water");
  740.     else
  741.       strcat(buffer," is sleeping here."); break;
  742.       case POSITION_FIGHTING :
  743.     if (i->specials.fighting) {
  744.       
  745.       strcat(buffer," is here, fighting ");
  746.       if (i->specials.fighting == ch)
  747.         strcat(buffer," YOU!");
  748.       else {
  749.         if (i->in_room == i->specials.fighting->in_room)
  750.           if (IS_NPC(i->specials.fighting))
  751.         strcat(buffer, i->specials.fighting->player.short_descr);
  752.           else
  753.         strcat(buffer, GET_NAME(i->specials.fighting));
  754.         else
  755.           strcat(buffer, "someone who has already left.");
  756.       }
  757.     } else /* NIL fighting pointer */
  758.       strcat(buffer," is here struggling with thin air.");
  759.     break;
  760.     default : strcat(buffer," is floating here."); break;
  761.       }
  762.       if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
  763.     if (IS_EVIL(i))
  764.       strcat(buffer, " (Red Aura)");
  765.       }
  766.       
  767.       if (num > 1) {
  768.     sprintf(tmp," [%d]", num);
  769.     strcat(buffer, tmp);
  770.       }
  771.       strcat(buffer,"\n\r");
  772.       send_to_char(buffer, ch);
  773.     } else {  /* npc with long */
  774.       
  775.       if (IS_AFFECTED(i,AFF_INVISIBLE))
  776.     strcpy(buffer,"*");
  777.       else
  778.     *buffer = '\0';
  779.       
  780.       if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
  781.     if (IS_EVIL(i))
  782.       strcat(buffer, " (Red Aura)");
  783.       }
  784.       
  785.       strcat(buffer, i->player.long_descr);
  786.       
  787.       /* this gets a little annoying */
  788.       
  789.       if (num > 1) {
  790.     while ((buffer[strlen(buffer)-1]=='\r') ||
  791.            (buffer[strlen(buffer)-1]=='\n') ||
  792.            (buffer[strlen(buffer)-1]==' ')) {
  793.       buffer[strlen(buffer)-1] = '\0';
  794.     }
  795.     sprintf(tmp," [%d]\n\r", num);
  796.     strcat(buffer, tmp);
  797.       }
  798.       
  799.       send_to_char(buffer, ch);
  800.     }
  801.     
  802.     if (IS_AFFECTED(i,AFF_SANCTUARY))
  803.       act("$n glows with a bright light!", FALSE, i, 0, ch, TO_VICT);
  804.     if (IS_AFFECTED(i,AFF_GROWTH))
  805.       act("$n is twice $s normal size!", FALSE, i, 0, ch, TO_VICT);
  806.     if (IS_AFFECTED(i, AFF_FIRESHIELD)) 
  807.       act("$n is surrounded by burning flames", FALSE, i, 0, ch, TO_VICT);
  808.     
  809.   } else if (mode == 1) {
  810.     
  811.     if (i->player.description)
  812.       send_to_char(i->player.description, ch);
  813.     else {
  814.       act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);
  815.     }
  816.     
  817.     /* Show a character to another */
  818.     
  819.     if (GET_MAX_HIT(i) > 0)
  820.       percent = (100*GET_HIT(i))/GET_MAX_HIT(i);
  821.     else
  822.       percent = -1; /* How could MAX_HIT be < 1?? */
  823.     
  824.     if (IS_NPC(i))
  825.       strcpy(buffer, i->player.short_descr);
  826.     else
  827.       strcpy(buffer, GET_NAME(i));
  828.     
  829.     if (percent >= 100)
  830.       strcat(buffer, " is in an excellent condition.\n\r");
  831.     else if (percent >= 90)
  832.       strcat(buffer, " has a few scratches.\n\r");
  833.     else if (percent >= 75)
  834.       strcat(buffer, " has some small wounds and bruises.\n\r");
  835.     else if (percent >= 50)
  836.       strcat(buffer, " has quite a few wounds.\n\r");
  837.     else if (percent >= 30)
  838.       strcat(buffer, " has some big nasty wounds and scratches.\n\r");
  839.     else if (percent >= 15)
  840.       strcat(buffer, " looks pretty hurt.\n\r");
  841.     else if (percent >= 0)
  842.       strcat(buffer, " is in an awful condition.\n\r");
  843.     else
  844.       strcat(buffer, " is bleeding awfully from big wounds.\n\r");
  845.     
  846.     send_to_char(buffer, ch);
  847.     
  848.     found = FALSE;
  849.     for (j=0; j< MAX_WEAR; j++) {
  850.       if (i->equipment[j]) {
  851.     if (CAN_SEE_OBJ(ch,i->equipment[j])) {
  852.       found = TRUE;
  853.     }
  854.       }
  855.     }
  856.     if (found) {
  857.       act("\n\r$n is using:", FALSE, i, 0, ch, TO_VICT);
  858.       for (j=0; j< MAX_WEAR; j++) {
  859.     if (i->equipment[j]) {
  860.       if (CAN_SEE_OBJ(ch,i->equipment[j])) {
  861.         send_to_char(where[j],ch);
  862.         show_obj_to_char(i->equipment[j],ch,1);
  863.       }
  864.     }
  865.       }
  866.     }
  867.     if ((HasClass(ch, CLASS_THIEF)) && (ch != i)) {
  868.       found = FALSE;
  869.       send_to_char("\n\rYou attempt to peek at the inventory:\n\r", ch);
  870.       for(tmp_obj = i->carrying; tmp_obj; tmp_obj = tmp_obj->next_content) {
  871.     if (CAN_SEE_OBJ(ch,tmp_obj)&&(number(0,MAX_MORT) < GetMaxLevel(ch))) {
  872.       show_obj_to_char(tmp_obj, ch, 1);
  873.       found = TRUE;
  874.     }
  875.       }
  876.       if (!found)
  877.     send_to_char("You can't see anything.\n\r", ch);
  878.     }
  879.     
  880.   } else if (mode == 2) {
  881.     
  882.     /* Lists inventory */
  883.     act("$n is carrying:", FALSE, i, 0, ch, TO_VICT);
  884.     list_obj_in_heap(i->carrying,ch);
  885.   }
  886. }
  887.  
  888.  
  889. void list_char_in_room(struct char_data *list, struct char_data *ch)
  890. {
  891.   struct char_data *i, *cond_ptr[50];
  892.   int k, cond_top, cond_tot[50], found=FALSE;  
  893.   
  894.   cond_top = 0; 
  895.   
  896.   for (i=list; i; i = i->next_in_room) {
  897.     if ( (ch!=i) && (!RIDDEN(i)) && (IS_AFFECTED(ch, AFF_SENSE_LIFE) ||
  898.              (CAN_SEE(ch,i) && !IS_AFFECTED(i, AFF_HIDE))) ) {
  899.       if ((cond_top< 50) && !MOUNTED(i)) {
  900.     found = FALSE;
  901.     if (IS_NPC(i)) {
  902.       for (k=0;(k<cond_top&& !found);k++) {
  903.         if (cond_top>0) {
  904.           if (i->nr == cond_ptr[k]->nr &&
  905.           (GET_POS(i) == GET_POS(cond_ptr[k])) &&
  906.           (i->specials.affected_by==cond_ptr[k]->specials.affected_by) &&  
  907.           (i->specials.fighting == cond_ptr[k]->specials.fighting) &&
  908.           (i->player.short_descr && cond_ptr[k]->player.short_descr &&
  909.            0==strcmp(i->player.short_descr,cond_ptr[k]->player.short_descr))) {
  910.         cond_tot[k] += 1;
  911.         found=TRUE;
  912.           }
  913.         }
  914.       }
  915.     }
  916.     if (!found) {
  917.       cond_ptr[cond_top] = i;
  918.       cond_tot[cond_top] = 1;
  919.       cond_top+=1;
  920.     }
  921.       } else {
  922.     show_char_to_char(i,ch,0);
  923.       }
  924.     }
  925.   }
  926.   
  927.   if (cond_top) {
  928.     for (k=0; k<cond_top; k++) {
  929.       if (cond_tot[k] > 1) {
  930.     show_mult_char_to_char(cond_ptr[k],ch,0,cond_tot[k]);
  931.       } else {
  932.     show_char_to_char(cond_ptr[k],ch,0);
  933.       }
  934.     }
  935.   }
  936. }
  937.  
  938.  
  939. void list_char_to_char(struct char_data *list, struct char_data *ch, 
  940.                int mode) {
  941.   struct char_data *i;
  942.   
  943.   for (i = list; i ; i = i->next_in_room) {
  944.     if ( (ch!=i) && (IS_AFFECTED(ch, AFF_SENSE_LIFE) ||
  945.              (CAN_SEE(ch,i) && !IS_AFFECTED(i, AFF_HIDE))) )
  946.       show_char_to_char(i,ch,0); 
  947.   } 
  948. }
  949.  
  950.  
  951.  
  952. void do_look(struct char_data *ch, char *argument, int cmd)
  953. {
  954.   char buffer[MAX_STRING_LENGTH];
  955.   char arg1[MAX_INPUT_LENGTH];
  956.   char arg2[MAX_INPUT_LENGTH];
  957.   int keyword_no, res;
  958.   int j, bits, temp;
  959.   bool found;
  960.   struct obj_data *tmp_object, *found_object;
  961.   struct char_data *tmp_char;
  962.   char *tmp_desc;
  963.   static char *keywords[]= { 
  964.     "north",
  965.     "east",
  966.     "south",
  967.     "west",
  968.     "up",
  969.     "down",
  970.     "in",
  971.     "at",
  972.     "",  /* Look at '' case */
  973.     "room",
  974.     "\n" };
  975.   
  976.   if (!ch->desc)
  977.     return;
  978.   
  979.   if (GET_POS(ch) < POSITION_SLEEPING)
  980.     send_to_char("You can't see anything but stars!\n\r", ch);
  981.   else if (GET_POS(ch) == POSITION_SLEEPING)
  982.     send_to_char("You can't see anything, you're sleeping!\n\r", ch);
  983.   else if ( IS_AFFECTED(ch, AFF_BLIND) )
  984.     send_to_char("You can't see a damn thing, you're blinded!\n\r", ch);
  985.   else if  ((IS_DARK(ch->in_room)) && (!IS_IMMORTAL(ch)) &&
  986.         (!IS_AFFECTED(ch, AFF_TRUE_SIGHT))) {
  987.     send_to_char("It is very dark in here...\n\r", ch);
  988.     if (IS_AFFECTED(ch, AFF_INFRAVISION)) {
  989.       list_char_in_room(real_roomp(ch->in_room)->people, ch);
  990.     }
  991.   } else {
  992.  
  993.     only_argument(argument, arg1);
  994.  
  995.     if (0==strn_cmp(arg1,"at",2) && isspace(arg1[2])) {
  996.       only_argument(argument+3, arg2);
  997.       keyword_no = 7;
  998.     } else if (0==strn_cmp(arg1,"in",2) && isspace(arg1[2])) {
  999.       only_argument(argument+3, arg2);
  1000.       keyword_no = 6;
  1001.     } else {
  1002.       keyword_no = search_block(arg1, keywords, FALSE);
  1003.     }
  1004.  
  1005.     if ((keyword_no == -1) && *arg1) {
  1006.       keyword_no = 7;
  1007.       only_argument(argument, arg2);
  1008.     }
  1009.     
  1010.  
  1011.     found = FALSE;
  1012.     tmp_object = 0;
  1013.     tmp_char     = 0;
  1014.     tmp_desc     = 0;
  1015.     
  1016.     switch(keyword_no) {
  1017.       /* look <dir> */
  1018.     case 0 :
  1019.     case 1 :
  1020.     case 2 : 
  1021.     case 3 : 
  1022.     case 4 :
  1023.     case 5 : {   
  1024.       struct room_direction_data    *exitp;
  1025.       exitp = EXIT(ch, keyword_no);
  1026.       if (exitp) {
  1027.     if (exitp->general_description) {
  1028.       send_to_char(exitp-> general_description, ch);
  1029.     } else {
  1030.       send_to_char("You see nothing special.\n\r", ch);
  1031.     }
  1032.     
  1033.     if (IS_SET(exitp->exit_info, EX_CLOSED) && 
  1034.         (exitp->keyword)) {
  1035.        if ((strcmp(fname(exitp->keyword), "secret")) &&
  1036.           (!IS_SET(exitp->exit_info, EX_SECRET))) {
  1037.           sprintf(buffer, "The %s is closed.\n\r", 
  1038.             fname(exitp->keyword));
  1039.           send_to_char(buffer, ch);
  1040.         } 
  1041.      } else {
  1042.        if (IS_SET(exitp->exit_info, EX_ISDOOR) &&
  1043.           exitp->keyword) {
  1044.           sprintf(buffer, "The %s is open.\n\r",
  1045.               fname(exitp->keyword));
  1046.           send_to_char(buffer, ch);
  1047.         }
  1048.      }
  1049.       } else {
  1050.     send_to_char("You see nothing special.\n\r", ch);
  1051.       }
  1052.       if (exitp && exitp->to_room && (!IS_SET(exitp->exit_info, EX_ISDOOR) ||
  1053.      (!IS_SET(exitp->exit_info, EX_CLOSED)))) {
  1054.     if (IS_AFFECTED(ch, AFF_SCRYING) || IS_IMMORTAL(ch)) {
  1055.       struct room_data    *rp;
  1056.       sprintf(buffer,"You look %swards.\n\r", dirs[keyword_no]);
  1057.       send_to_char(buffer, ch);
  1058.  
  1059.       sprintf(buffer,"$n looks %swards.", dirs[keyword_no]);
  1060.       act(buffer, FALSE, ch, 0, 0, TO_ROOM);
  1061.  
  1062.       rp = real_roomp(exitp->to_room);
  1063.       if (!rp) {
  1064.         send_to_char("You see swirling chaos.\n\r", ch);
  1065.       } else if(exitp) {
  1066.         sprintf(buffer, "%d look", exitp->to_room);
  1067.         do_at(ch, buffer, 0);
  1068.       } else {
  1069.         send_to_char("You see nothing special.\n\r", ch);
  1070.       }
  1071.     }
  1072.       }
  1073.     }
  1074.       break;
  1075.       
  1076.       /* look 'in'    */
  1077.     case 6: {
  1078.       if (*arg2) {
  1079.     /* Item carried */
  1080.     bits = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM |
  1081.                 FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object);
  1082.     
  1083.     if (bits) { /* Found something */
  1084.       if (GET_ITEM_TYPE(tmp_object)== ITEM_DRINKCON)     {
  1085.         if (tmp_object->obj_flags.value[1] <= 0) {
  1086.           act("It is empty.", FALSE, ch, 0, 0, TO_CHAR);
  1087.         } else {
  1088.           temp=((tmp_object->obj_flags.value[1]*3)/tmp_object->obj_flags.value[0]);
  1089.           sprintf(buffer,"It's %sfull of a %s liquid.\n\r",
  1090.               fullness[temp],color_liquid[tmp_object->obj_flags.value[2]]);
  1091.           send_to_char(buffer, ch);
  1092.         }
  1093.       } else if (GET_ITEM_TYPE(tmp_object) == ITEM_CONTAINER) {
  1094.         if (!IS_SET(tmp_object->obj_flags.value[1],CONT_CLOSED)) {
  1095.           send_to_char(fname(tmp_object->name), ch);
  1096.           switch (bits) {
  1097.           case FIND_OBJ_INV :
  1098.         send_to_char(" (carried) : \n\r", ch);
  1099.         break;
  1100.           case FIND_OBJ_ROOM :
  1101.         send_to_char(" (here) : \n\r", ch);
  1102.         break;
  1103.           case FIND_OBJ_EQUIP :
  1104.         send_to_char(" (used) : \n\r", ch);
  1105.         break;
  1106.           }
  1107.           list_obj_in_heap(tmp_object->contains, ch);
  1108.         } else
  1109.           send_to_char("It is closed.\n\r", ch);
  1110.       } else {
  1111.         send_to_char("That is not a container.\n\r", ch);
  1112.       }
  1113.     } else { /* wrong argument */
  1114.       send_to_char("You do not see that item here.\n\r", ch);
  1115.     }
  1116.       } else { /* no argument */
  1117.     send_to_char("Look in what?!\n\r", ch);
  1118.       }
  1119.     }
  1120.       break;
  1121.       
  1122.       /* look 'at'    */
  1123.     case 7 : {
  1124.       if (*arg2) {
  1125.     bits = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM |
  1126.                 FIND_OBJ_EQUIP | FIND_CHAR_ROOM, ch, &tmp_char, &found_object);
  1127.     if (tmp_char) {
  1128.       show_char_to_char(tmp_char, ch, 1);
  1129.       if (ch != tmp_char) {
  1130.         act("$n looks at you.", TRUE, ch, 0, tmp_char, TO_VICT);
  1131.         act("$n looks at $N.", TRUE, ch, 0, tmp_char, TO_NOTVICT);
  1132.       }
  1133.       return;
  1134.     }
  1135.     /* 
  1136.       Search for Extra Descriptions in room and items 
  1137.       */
  1138.     
  1139.     /* Extra description in room?? */
  1140.     if (!found) {
  1141.       tmp_desc = find_ex_description(arg2, 
  1142.                      real_roomp(ch->in_room)->ex_description);
  1143.       if (tmp_desc) {
  1144.         page_string(ch->desc, tmp_desc, 0);
  1145.         return; 
  1146.       }
  1147.     }
  1148.     
  1149.     /* extra descriptions in items */
  1150.     
  1151.     /* Equipment Used */
  1152.     if (!found) {
  1153.       for (j = 0; j< MAX_WEAR && !found; j++) {
  1154.         if (ch->equipment[j]) {
  1155.           if (CAN_SEE_OBJ(ch,ch->equipment[j])) {
  1156.         tmp_desc = find_ex_description(arg2, 
  1157.                            ch->equipment[j]->ex_description);
  1158.         if (tmp_desc) {
  1159.           page_string(ch->desc, tmp_desc, 1);
  1160.           found = TRUE;
  1161.         }
  1162.           }
  1163.         }
  1164.       }
  1165.     }
  1166.     /* In inventory */
  1167.     if (!found) {
  1168.       for(tmp_object = ch->carrying; 
  1169.           tmp_object && !found; 
  1170.           tmp_object = tmp_object->next_content) {
  1171.         if CAN_SEE_OBJ(ch, tmp_object) {
  1172.           tmp_desc = find_ex_description(arg2, 
  1173.                          tmp_object->ex_description);
  1174.           if (tmp_desc) {
  1175.         page_string(ch->desc, tmp_desc, 1);
  1176.         found = TRUE;
  1177.           }
  1178.         }
  1179.       }
  1180.     }
  1181.     /* Object In room */
  1182.     
  1183.     if (!found) {
  1184.       for(tmp_object = real_roomp(ch->in_room)->contents; 
  1185.           tmp_object && !found; 
  1186.           tmp_object = tmp_object->next_content) {
  1187.         if CAN_SEE_OBJ(ch, tmp_object) {
  1188.           tmp_desc = find_ex_description(arg2, 
  1189.                          tmp_object->ex_description);
  1190.           if (tmp_desc) {
  1191.         page_string(ch->desc, tmp_desc, 1);
  1192.         found = TRUE;
  1193.           }
  1194.         }
  1195.       }
  1196.     }
  1197.     /* wrong argument */
  1198.     if (bits) { /* If an object was found */
  1199.       if (!found)
  1200.         show_obj_to_char(found_object, ch, 5); 
  1201.       /* Show no-description */
  1202.       else
  1203.         show_obj_to_char(found_object, ch, 6); 
  1204.       /* Find hum, glow etc */
  1205.     } else if (!found) {
  1206.       send_to_char("You do not see that here.\n\r", ch);
  1207.     }
  1208.       } else {
  1209.     /* no argument */    
  1210.     send_to_char("Look at what?\n\r", ch);
  1211.       }
  1212.     }
  1213.       break;
  1214.       
  1215.       /* look ''        */ 
  1216.     case 8 : {
  1217.       send_to_char(real_roomp(ch->in_room)->name, ch);
  1218.       send_to_char("\n\r", ch);
  1219.       if (!IS_SET(ch->specials.act, PLR_BRIEF))
  1220.     send_to_char(real_roomp(ch->in_room)->description, ch);
  1221.       
  1222.       if (!IS_NPC(ch)) {
  1223.     if (IS_SET(ch->specials.act, PLR_HUNTING)) {
  1224.       if (ch->specials.hunting) {
  1225.         res = track(ch, ch->specials.hunting);
  1226.         if (!res) {
  1227.           ch->specials.hunting = 0;
  1228.           ch->hunt_dist = 0;
  1229.           REMOVE_BIT(ch->specials.act, PLR_HUNTING);
  1230.         }
  1231.       } else {
  1232.         ch->hunt_dist = 0;
  1233.         REMOVE_BIT(ch->specials.act, PLR_HUNTING);
  1234.       }
  1235.     }
  1236.       } else {
  1237.     if (IS_SET(ch->specials.act, ACT_HUNTING)) {
  1238.       if (ch->specials.hunting) {
  1239.         res = track(ch, ch->specials.hunting);
  1240.         if (!res) {
  1241.           ch->specials.hunting = 0;
  1242.           ch->hunt_dist = 0;
  1243.           REMOVE_BIT(ch->specials.act, ACT_HUNTING);
  1244.         }  
  1245.       } else {
  1246.         ch->hunt_dist = 0;
  1247.         REMOVE_BIT(ch->specials.act, ACT_HUNTING);
  1248.       }
  1249.     }
  1250.       }
  1251.       
  1252.       list_obj_in_room(real_roomp(ch->in_room)->contents, ch);
  1253.       list_char_in_room(real_roomp(ch->in_room)->people, ch);
  1254.       
  1255.     }
  1256.       break;
  1257.       
  1258.       /* wrong arg    */
  1259.     case -1 : 
  1260.       send_to_char("Sorry, I didn't understand that!\n\r", ch);
  1261.       break;
  1262.       
  1263.       /* look 'room' */
  1264.     case 9 : {
  1265.       
  1266.       send_to_char(real_roomp(ch->in_room)->name, ch);
  1267.       send_to_char("\n\r", ch);
  1268.       send_to_char(real_roomp(ch->in_room)->description, ch);
  1269.       
  1270.       if (!IS_NPC(ch)) {
  1271.     if (IS_SET(ch->specials.act, PLR_HUNTING)) {
  1272.       if (ch->specials.hunting) {
  1273.         res = track(ch, ch->specials.hunting);
  1274.         if (!res) {
  1275.           ch->specials.hunting = 0;
  1276.           ch->hunt_dist = 0;
  1277.           REMOVE_BIT(ch->specials.act, PLR_HUNTING);
  1278.         }
  1279.       } else {
  1280.         ch->hunt_dist = 0;
  1281.         REMOVE_BIT(ch->specials.act, PLR_HUNTING);
  1282.       }
  1283.     }
  1284.       } else {
  1285.     if (IS_SET(ch->specials.act, ACT_HUNTING)) {
  1286.       if (ch->specials.hunting) {
  1287.         res = track(ch, ch->specials.hunting);
  1288.         if (!res) {
  1289.           ch->specials.hunting = 0;
  1290.           ch->hunt_dist = 0;
  1291.           REMOVE_BIT(ch->specials.act, ACT_HUNTING);
  1292.         }  
  1293.       } else {
  1294.         ch->hunt_dist = 0;
  1295.         REMOVE_BIT(ch->specials.act, ACT_HUNTING);
  1296.       }
  1297.     }
  1298.       }
  1299.       
  1300.       list_obj_in_room(real_roomp(ch->in_room)->contents, ch);
  1301.       list_char_in_room(real_roomp(ch->in_room)->people, ch);
  1302.       
  1303.     }
  1304.       break;
  1305.     }
  1306.   }
  1307. }
  1308.  
  1309. /* end of look */
  1310.  
  1311.  
  1312.  
  1313.  
  1314. void do_read(struct char_data *ch, char *argument, int cmd)
  1315. {
  1316.   char buf[100];
  1317.   
  1318.   /* This is just for now - To be changed later.! */
  1319.   sprintf(buf,"at %s",argument);
  1320.   do_look(ch,buf,15);
  1321. }
  1322.  
  1323.  
  1324.  
  1325. void do_examine(struct char_data *ch, char *argument, int cmd)
  1326. {
  1327.   char name[100], buf[100];
  1328.   struct char_data *tmp_char;
  1329.   struct obj_data *tmp_object;
  1330.   
  1331.   sprintf(buf,"at %s",argument);
  1332.   do_look(ch,buf,15);
  1333.   
  1334.   one_argument(argument, name);
  1335.   
  1336.   if (!*name) {
  1337.     send_to_char("Examine what?\n\r", ch);
  1338.     return;
  1339.   }
  1340.   
  1341.   generic_find(name, FIND_OBJ_INV | FIND_OBJ_ROOM |
  1342.               FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object);
  1343.   
  1344.   if (tmp_object) {
  1345.     if ((GET_ITEM_TYPE(tmp_object)==ITEM_DRINKCON) ||
  1346.     (GET_ITEM_TYPE(tmp_object)==ITEM_CONTAINER)) {
  1347.       send_to_char("When you look inside, you see:\n\r", ch);
  1348.       sprintf(buf,"in %s",argument);
  1349.       do_look(ch,buf,15);
  1350.     }
  1351.   }
  1352. }
  1353.  
  1354. #if 0
  1355. void do_exits(struct char_data *ch, char *argument, int cmd)
  1356. {
  1357.   int door;
  1358.   char buf[1000];
  1359.   struct room_direction_data    *exitdata;
  1360.   extern char *exits[];
  1361.   
  1362.   *buf = '\0';
  1363.   
  1364.   for (door = 0; door <= 5; door++) {
  1365.     exitdata = EXIT(ch,door);
  1366.     if (exitdata) {
  1367.       if (!real_roomp(exitdata->to_room)) {
  1368.     /* don't print unless immortal */
  1369.     if (IS_IMMORTAL(ch)) {
  1370.       sprintf(buf + strlen(buf), "%s - swirling chaos of #%d\n\r",
  1371.               exits[door], exitdata->to_room);
  1372.         }
  1373.       } else if (exitdata->to_room != NOWHERE &&
  1374.          (!IS_SET(exitdata->exit_info, EX_CLOSED) ||
  1375.           IS_IMMORTAL(ch))) {
  1376.     if (IS_DARK(exitdata->to_room))
  1377.       sprintf(buf + strlen(buf), "%s - Too dark to tell", exits[door]);
  1378.     else
  1379.       sprintf(buf + strlen(buf), "%s - %s", exits[door],
  1380.           real_roomp(exitdata->to_room)->name);
  1381.     if (IS_SET(exitdata->exit_info, EX_CLOSED))
  1382.       strcat(buf, " (closed)");
  1383.     strcat(buf, "\n\r");
  1384.       }
  1385.     }
  1386.   }
  1387.   
  1388.   send_to_char("Obvious exits:\n\r", ch);
  1389.   
  1390.   if (*buf)
  1391.     send_to_char(buf, ch);
  1392.   else
  1393.     send_to_char("None.\n\r", ch);
  1394. }
  1395. #else
  1396.  
  1397. /*  Gecko's spiffy enhancement to do_exits() from act.info.c */
  1398.  
  1399. void do_exits(struct char_data *ch, char *argument, int cmd)
  1400. {
  1401.   /* NOTE: Input var 'cmd' is not used. */
  1402.   int door;
  1403.   char buf[1000];
  1404.   struct room_direction_data *exitdata;
  1405.   extern char *exits[];
  1406.   
  1407.   *buf = '\0';
  1408.   
  1409.   for (door = 0; door <= 5; door++) {
  1410.     exitdata = EXIT(ch,door);
  1411.     if (exitdata) {
  1412.       if (!real_roomp(exitdata->to_room)) {
  1413.     /* don't print unless immortal */
  1414.     if (IS_IMMORTAL(ch)) {
  1415.       sprintf(buf + strlen(buf), "%s - swirling chaos of #%d\n\r",
  1416.               exits[door], exitdata->to_room);
  1417.         }
  1418.       }
  1419.       else if (exitdata->to_room != NOWHERE) {
  1420.         if (IS_IMMORTAL(ch)){
  1421.           sprintf(buf + strlen(buf), "%s - %s", exits[door],
  1422.                   real_roomp(exitdata->to_room)->name);
  1423.           if(IS_SET(exitdata->exit_info, EX_CLOSED))
  1424.             strcat(buf, " (closed)");
  1425.           if(IS_DARK(exitdata->to_room))
  1426.             strcat(buf, " (dark)");
  1427.           sprintf(buf + strlen(buf), " #%d\n\r", exitdata->to_room);
  1428.         }
  1429.         else if (!IS_SET(exitdata->exit_info, EX_CLOSED)) {
  1430.           if (IS_DARK(exitdata->to_room))
  1431.             sprintf(buf + strlen(buf), "%s - Too dark to tell\n\r", 
  1432.                     exits[door]);
  1433.           else
  1434.             sprintf(buf + strlen(buf), "%s - %s\n\r", exits[door],
  1435.               real_roomp(exitdata->to_room)->name);
  1436.         }
  1437.       }
  1438.     }
  1439.   }
  1440.   
  1441.   send_to_char("Obvious exits:\n\r", ch);
  1442.   
  1443.   if (*buf)
  1444.     send_to_char(buf, ch);
  1445.   else
  1446.     send_to_char("None.\n\r", ch);
  1447. }
  1448.  
  1449. #endif
  1450.  
  1451. void do_score(struct char_data *ch, char *argument, int cmd)
  1452. {
  1453.   struct time_info_data playing_time;
  1454.   static char buf[100], buf2[100];
  1455.   struct time_info_data my_age;
  1456.   extern const struct title_type titles[MAX_CLASS][ABS_MAX_LVL];
  1457.   extern char *RaceNames[];
  1458.   
  1459.   struct time_info_data real_time_passed(time_t t2, time_t t1);
  1460.  
  1461.   age2(ch, &my_age);
  1462.   sprintf(buf, "You are %d years old.", my_age.year);
  1463.   
  1464.   
  1465.   if ((my_age.month == 0) && (my_age.year == 0))
  1466.     strcat(buf," It's your birthday today.\n\r");
  1467.   else
  1468.     strcat(buf,"\n\r");
  1469.   send_to_char(buf, ch);
  1470.  
  1471.   sprintf(buf, "You belong to the %s race\n\r", RaceName[GET_RACE(ch)]);
  1472.   send_to_char(buf, ch);
  1473.   
  1474.   if (!IS_IMMORTAL(ch) && (!IS_NPC(ch))) {
  1475.     if (GET_COND(ch,DRUNK)>10)
  1476.       send_to_char("You are intoxicated.\n\r", ch);
  1477.     if (GET_COND(ch,FULL)<2)
  1478.       send_to_char("You are hungry...\n\r", ch);
  1479.     if (GET_COND(ch,THIRST)<2)
  1480.       send_to_char("You are thirsty...\n\r", ch);
  1481.   }
  1482.   
  1483.   sprintf(buf, 
  1484.       "You have %d(%d) hit, %d(%d) mana and %d(%d) movement points.\n\r",
  1485.       GET_HIT(ch),GET_MAX_HIT(ch),
  1486.       GET_MANA(ch),GET_MAX_MANA(ch),
  1487.       GET_MOVE(ch),GET_MAX_MOVE(ch));
  1488.   send_to_char(buf,ch);
  1489.   
  1490.   sprintf(buf, "Your alignment is: %s\n\r", AlignDesc(GET_ALIGNMENT(ch)));
  1491.   send_to_char(buf,ch);
  1492.   
  1493.   sprintf(buf,"You have scored %d exp, and have %d gold coins.\n\r",
  1494.       GET_EXP(ch),GET_GOLD(ch));
  1495.   send_to_char(buf,ch);
  1496.  
  1497.   buf[0] = '\0';
  1498.   sprintf(buf, "Your levels:");
  1499.   if (HasClass(ch, CLASS_MAGIC_USER)) {
  1500.     sprintf(buf2, " M:%d", GET_LEVEL(ch, MAGE_LEVEL_IND));
  1501.     strcat(buf, buf2);
  1502.   }
  1503.   if (HasClass(ch, CLASS_CLERIC)) {
  1504.     sprintf(buf2, " C:%d", GET_LEVEL(ch, CLERIC_LEVEL_IND));
  1505.     strcat(buf, buf2);
  1506.   }
  1507.   if (HasClass(ch, CLASS_WARRIOR)) {
  1508.     sprintf(buf2, " W:%d", GET_LEVEL(ch, WARRIOR_LEVEL_IND));
  1509.     strcat(buf, buf2);
  1510.   }
  1511.   if (HasClass(ch, CLASS_THIEF)) {
  1512.     sprintf(buf2, " T:%d", GET_LEVEL(ch, THIEF_LEVEL_IND));
  1513.     strcat(buf, buf2);
  1514.   }
  1515.   if (HasClass(ch, CLASS_DRUID)) {
  1516.     sprintf(buf2, " D:%d", GET_LEVEL(ch, DRUID_LEVEL_IND));
  1517.     strcat(buf, buf2);
  1518.   }
  1519.   if (HasClass(ch, CLASS_MONK)) {
  1520.     sprintf(buf2, " K:%d", GET_LEVEL(ch, MONK_LEVEL_IND));
  1521.     strcat(buf, buf2);
  1522.   }
  1523.  
  1524.   strcat(buf, "\n\r");
  1525.   send_to_char(buf,ch);
  1526.  
  1527.   if (GET_TITLE(ch)) {
  1528.     sprintf(buf,"This ranks you as %s %s\n\r", GET_NAME(ch), GET_TITLE(ch));
  1529.     send_to_char(buf,ch);
  1530.   }
  1531.   
  1532.   playing_time = real_time_passed((time(0)-ch->player.time.logon) +
  1533.                   ch->player.time.played, 0);
  1534.   sprintf(buf,"You have been playing for %d days and %d hours.\n\r",
  1535.       playing_time.day,
  1536.       playing_time.hours);        
  1537.   send_to_char(buf, ch);        
  1538.   
  1539.   switch(GET_POS(ch)) {
  1540.   case POSITION_DEAD : 
  1541.     send_to_char("You are DEAD!\n\r", ch); break;
  1542.   case POSITION_MORTALLYW :
  1543.     send_to_char("You are mortally wounded!, you should seek help!\n\r", ch); break;
  1544.   case POSITION_INCAP : 
  1545.     send_to_char("You are incapacitated, slowly fading away\n\r", ch); break;
  1546.   case POSITION_STUNNED : 
  1547.     send_to_char("You are stunned! You can't move\n\r", ch); break;
  1548.   case POSITION_SLEEPING : 
  1549.     send_to_char("You are sleeping.\n\r",ch); break;
  1550.   case POSITION_RESTING  : 
  1551.     send_to_char("You are resting.\n\r",ch); break;
  1552.   case POSITION_SITTING  : 
  1553.     send_to_char("You are sitting.\n\r",ch); break;
  1554.   case POSITION_FIGHTING :
  1555.     if (ch->specials.fighting)
  1556.       act("You are fighting $N.\n\r", FALSE, ch, 0,
  1557.       ch->specials.fighting, TO_CHAR);
  1558.     else
  1559.       send_to_char("You are fighting thin air.\n\r", ch);
  1560.     break;
  1561.   case POSITION_STANDING : 
  1562.     send_to_char("You are standing.\n\r",ch); break;
  1563.   case POSITION_MOUNTED:
  1564.     if (MOUNTED(ch)) {
  1565.       send_to_char("You are riding on ",ch); 
  1566.       send_to_char(MOUNTED(ch)->player.short_descr, ch);
  1567.       send_to_char("\n\r", ch);
  1568.     } else {
  1569.       send_to_char("You are standing.\n\r",ch); break;
  1570.     }
  1571.     break;
  1572.     default :
  1573.       send_to_char("You are floating.\n\r",ch); break;
  1574.   }
  1575.   
  1576. }
  1577.  
  1578.  
  1579. void do_time(struct char_data *ch, char *argument, int cmd)
  1580. {
  1581.   char buf[100], *suf;
  1582.   int weekday, day;
  1583.   extern struct time_info_data time_info;
  1584.   extern const char *weekdays[];
  1585.   extern const char *month_name[];
  1586.   
  1587.   sprintf(buf, "It is %d o'clock %s, on ",
  1588.       ((time_info.hours % 12 == 0) ? 12 : ((time_info.hours) % 12)),
  1589.       ((time_info.hours >= 12) ? "pm" : "am") );
  1590.   
  1591.   weekday = ((35*time_info.month)+time_info.day+1) % 7;/* 35 days in a month */
  1592.   
  1593.   strcat(buf,weekdays[weekday]);
  1594.   strcat(buf,"\n\r");
  1595.   send_to_char(buf,ch);
  1596.   
  1597.   day = time_info.day + 1;   /* day in [1..35] */
  1598.   
  1599.   if (day == 1)
  1600.     suf = "st";
  1601.   else if (day == 2)
  1602.     suf = "nd";
  1603.   else if (day == 3)
  1604.     suf = "rd";
  1605.   else if (day < 20)
  1606.     suf = "th";
  1607.   else if ((day % 10) == 1)
  1608.     suf = "st";
  1609.   else if ((day % 10) == 2)
  1610.     suf = "nd";
  1611.   else if ((day % 10) == 3)
  1612.     suf = "rd";
  1613.   else
  1614.     suf = "th";
  1615.   
  1616.   sprintf(buf, "The %d%s Day of the %s, Year %d.\n\r",
  1617.       day,
  1618.       suf,
  1619.       month_name[time_info.month],
  1620.       time_info.year);
  1621.   
  1622.   send_to_char(buf,ch);
  1623. }
  1624.  
  1625.  
  1626. void do_weather(struct char_data *ch, char *argument, int cmd)
  1627. {
  1628.   extern struct weather_data weather_info;
  1629.   static char buf[100];
  1630.   char static *sky_look[4]= {
  1631.     "cloudless",
  1632.     "cloudy",
  1633.     "rainy",
  1634.     "lit by flashes of lightning"};
  1635.   
  1636.   if (OUTSIDE(ch)) {
  1637.     sprintf(buf, 
  1638.         "The sky is %s and %s.\n\r",
  1639.         sky_look[weather_info.sky],
  1640.         (weather_info.change >=0 ? "you feel a warm wind from south" :
  1641.          "your foot tells you bad weather is due"));
  1642.     send_to_char(buf,ch);
  1643.   } else
  1644.     send_to_char("You have no feeling about the weather at all.\n\r", ch);
  1645. }
  1646.  
  1647.  
  1648. void do_help(struct char_data *ch, char *argument, int cmd)
  1649. {
  1650.  
  1651.   extern int top_of_helpt;
  1652.   extern struct help_index_element *help_index;
  1653.   extern FILE *help_fl;
  1654.   extern char help[MAX_STRING_LENGTH];
  1655.   
  1656.   int chk, bot, top, mid, minlen;
  1657.   char buf[MAX_STRING_LENGTH], buffer[MAX_STRING_LENGTH];
  1658.   
  1659.   
  1660.   if (!ch->desc)
  1661.     return;
  1662.   
  1663.   for(;isspace(*argument); argument++)  ;
  1664.   
  1665.   
  1666.   if (*argument)
  1667.     {
  1668.       if (!help_index)    {
  1669.       send_to_char("No help available.\n\r", ch);
  1670.       return;
  1671.     }
  1672.       bot = 0;
  1673.       top = top_of_helpt;
  1674.       
  1675.       for (;;)
  1676.     {
  1677.       mid = (bot + top) / 2;
  1678.       minlen = strlen(argument);
  1679.       
  1680.       if (!(chk = strn_cmp(argument, help_index[mid].keyword, minlen)))
  1681.         {
  1682.           fseek(help_fl, help_index[mid].pos, 0);
  1683.           *buffer = '\0';
  1684.           for (;;)    {
  1685.           fgets(buf, 80, help_fl);
  1686.           if (*buf == '#')
  1687.             break;
  1688.           if (strlen(buf)+strlen(buffer) > MAX_STRING_LENGTH-2)
  1689.             break;
  1690.           strcat(buffer, buf);
  1691.           strcat(buffer, "\r");
  1692.         }
  1693.           page_string(ch->desc, buffer, 1);
  1694.           return;
  1695.         }      else if (bot >= top)        {
  1696.           send_to_char("There is no help on that word.\n\r", ch);
  1697.           return;
  1698.         }
  1699.       else if (chk > 0)
  1700.         bot = ++mid;
  1701.       else
  1702.         top = --mid;
  1703.     }
  1704.       return;
  1705.     }
  1706.   
  1707.   
  1708.   send_to_char(help, ch);
  1709.   
  1710. }
  1711.  
  1712.  
  1713. void do_wizhelp(struct char_data *ch, char *arg, int cmd)
  1714. {
  1715.  char buf[1000];
  1716.  int i, j = 1;
  1717.  NODE *n;
  1718.  extern struct radix_list radix_head[];
  1719.  
  1720.  if(IS_NPC(ch))
  1721.     return;
  1722.  
  1723.  sprintf(buf, "Wizard Commands Available To You:\n\r\n\r");
  1724.  
  1725.  for(i = 0; i < 26; i++) {
  1726.     n = radix_head[i].next;
  1727.     while(n) {
  1728.         if(n->min_level <= GetMaxLevel(ch) && n->min_level >= LOW_IMMORTAL) {
  1729.            sprintf((buf + strlen(buf)), "%-10s", n->name);
  1730.            if(!(j % 7))
  1731.               sprintf((buf + strlen(buf)), "\n\r");
  1732.            j++;
  1733.      }
  1734.         n = n->next;
  1735.       }
  1736.   }
  1737.  
  1738.  strcat(buf, "\n\r");
  1739.  
  1740.  page_string(ch->desc, buf, 1);
  1741. }
  1742.  
  1743.  
  1744. void do_who(struct char_data *ch, char *argument, int cmd)
  1745. {
  1746.   struct descriptor_data *d;
  1747.   char buf[256];
  1748.   int count, gods;
  1749.   struct char_data    *person;
  1750.  
  1751.   /*  check for an arg */
  1752.   only_argument(argument, buf);  
  1753.   if (*buf) {
  1754.     gods = TRUE;
  1755.   }  else {
  1756.     gods = FALSE;
  1757.   }
  1758.  
  1759.   if (!IS_IMMORTAL(ch) || cmd == 234) {
  1760.  
  1761.     send_to_char("Players\n\r-------\n\r", ch);
  1762.     count=0;
  1763.     for (d = descriptor_list; d; d = d->next) {
  1764.       if (!d->connected && CAN_SEE(ch, d->character) &&
  1765.       ( real_roomp((person = (d->original ? d->original:d->character)
  1766.             )->in_room)) &&
  1767.       ( real_roomp((person = (d->original ? d->original:d->character)
  1768.             )->in_room)->zone == real_roomp(ch->in_room)->zone || 
  1769.        cmd!=234 ) && (!gods || IS_IMMORTAL(d->character))) {
  1770.     count++;
  1771.     sprintf(buf, "%s %s", 
  1772.         GET_NAME(person),
  1773.         (person->player.title?person->player.title:"(Null)"));
  1774.     
  1775.     if (cmd==234) { /* it's a whozone command */
  1776.       if ((!IS_AFFECTED(person, AFF_HIDE)) || (IS_IMMORTAL(ch))) {
  1777.         sprintf(buf,"%-25s - %s ", GET_NAME(person),
  1778.             real_roomp(person->in_room)->name);
  1779.         if (GetMaxLevel(ch) >= LOW_IMMORTAL)
  1780.           sprintf(buf+strlen(buf),"[%d]", person->in_room);
  1781.       }
  1782.     } else {
  1783.       sprintf(buf, "%s %s", GET_NAME(person), 
  1784.           (person->player.title?person->player.title:"(null)"));
  1785.     }
  1786.     strcat(buf, "\n\r");
  1787.     
  1788.     send_to_char(buf, ch);
  1789.       }
  1790.     }
  1791.     sprintf(buf, "\n\rTotal visible players: %d\n\r", count);
  1792.     send_to_char(buf, ch);
  1793.     
  1794.   } else {
  1795.     int listed = 0, count, lcount, l, skip = FALSE;
  1796.     char arg[256], tempbuf[256];
  1797.  
  1798.     send_to_char("Players [God Version -? for Help]\n\r",ch);
  1799.     send_to_char("--------\n\r", ch);
  1800.     count=0;
  1801.     lcount=0;
  1802.     if (strlen(argument) == 0) {
  1803.       for (person = character_list; person; person = person->next) {
  1804.     if ((!IS_NPC(person)) || (IS_SET(person->specials.act, ACT_POLYSELF))) {
  1805.       count++;
  1806.       if (person->desc == NULL) {
  1807.         lcount++;
  1808.       } else {
  1809.         sprintf(buf, "%s %s\n\r", GET_NAME(person), (person->player.title?person->player.title:"(null)"));
  1810.         send_to_char(buf, ch);
  1811.       }
  1812.     }
  1813.       }
  1814.     } else {
  1815.       argument = one_argument(argument,arg);
  1816.       if (arg[0] == '-') {
  1817.     if (index(arg,'?') != NULL) {
  1818.       send_to_char("[-]i=idle l=levels t=title h=hit/mana/move s=stats\n\r",ch);
  1819.       send_to_char("[-]d=linkdead g=God o=Mort [1]Mage[2]Cleric[3]War[4]Thief[5]Druid[6]Monk\n\r", ch);
  1820.     send_to_char("--------\n\r", ch);  
  1821.     }
  1822.     for (person = character_list; person; person = person->next) {
  1823.       if (!IS_NPC(person)) {
  1824.         count++;
  1825.         if (person->desc == NULL) lcount ++;
  1826.         skip = FALSE;
  1827.         if (index(arg,'g') != NULL) {
  1828.           if (!IS_IMMORTAL(person)) skip = TRUE;
  1829.         }
  1830.         if (index(arg,'o') != NULL) {
  1831.           if (IS_IMMORTAL(person)) skip = TRUE;
  1832.         }
  1833.         if (index(arg,'1') != NULL) {
  1834.           if (!HasClass(person,CLASS_MAGIC_USER)) skip = TRUE;
  1835.         }
  1836.         if (index(arg,'2') != NULL) {
  1837.           if (!HasClass(person,CLASS_CLERIC)) skip = TRUE;
  1838.         }
  1839.         if (index(arg,'3') != NULL) {
  1840.           if (!HasClass(person,CLASS_WARRIOR)) skip = TRUE;
  1841.         }
  1842.         if (index(arg,'4') != NULL) {
  1843.           if (!HasClass(person,CLASS_THIEF)) skip = TRUE;
  1844.         }
  1845.         if (index(arg,'5') != NULL) {
  1846.           if (!HasClass(person,CLASS_DRUID)) skip = TRUE;
  1847.         }
  1848.         if (index(arg,'6') != NULL) {
  1849.           if (!HasClass(person,CLASS_MONK)) skip = TRUE;
  1850.         }
  1851.         if (!skip) {
  1852.           if (person->desc == NULL) {
  1853.         if (index(arg,'d') != NULL) {
  1854.           sprintf(buf, "[%-12s] ", GET_NAME(person));
  1855.           listed++;
  1856.         }
  1857.           } else {
  1858.         if (IS_NPC(person) && 
  1859.             IS_SET(person->specials.act, ACT_POLYSELF)) {
  1860.           sprintf(buf, "(%-14s) ", GET_NAME(person));
  1861.           listed++;
  1862.         } else {
  1863.           sprintf(buf, "%-14s ", GET_NAME(person));
  1864.           listed++;
  1865.         }
  1866.           }
  1867.           if ((person->desc != NULL) || (index(arg,'d') != NULL)) {
  1868.         for (l = 1; l <= strlen(arg) ; l++) {
  1869.           switch (arg[l]) {
  1870.           case 'i': {
  1871.             sprintf(tempbuf,"Idle:[%-3d] ",person->specials.timer);
  1872.             strcat(buf,tempbuf);
  1873.             break;
  1874.           }
  1875.           case 'l': {
  1876.             sprintf(tempbuf,"Level:[%-2d/%-2d/%-2d/%-2d/%-2d/%-2d] ",
  1877.                 person->player.level[0],person->player.level[1],
  1878.                 person->player.level[2],person->player.level[3],
  1879.                 person->player.level[4],person->player.level[5]);
  1880.             strcat(buf,tempbuf);
  1881.             break;
  1882.           }
  1883.           case 'h': {
  1884.             sprintf(tempbuf,"Hit:[%-3d] Mana:[%-3d] Move:[%-3d] ",GET_HIT(person),GET_MANA(person),GET_MOVE(person));
  1885.             strcat(buf,tempbuf);
  1886.             break;
  1887.           }         
  1888.           case 's': {
  1889.             sprintf(tempbuf,"[S:%-2d I:%-2d W:%-2d C:%-2d D:%-2d] ",GET_STR(person),GET_INT(person),GET_WIS(person),GET_CON(person),GET_DEX(person));
  1890.             strcat(buf,tempbuf);
  1891.             break;
  1892.           }         
  1893.           case 't': {
  1894.             sprintf(tempbuf," %-16s ",(person->player.title?person->player.title:"(null)"));
  1895.             strcat(buf,tempbuf);
  1896.             break;
  1897.           }         
  1898.           default: {
  1899.             break;
  1900.           }
  1901.           }
  1902.         }
  1903.           }
  1904.           if ((person->desc != NULL) || (index(arg,'d') != NULL)) {
  1905.         strcat(buf,"\n\r");
  1906.         send_to_char(buf,ch);
  1907.           }
  1908.         }
  1909.       }
  1910.     }
  1911.       } else {
  1912.     /* list gods */
  1913.     for (person = character_list; person; person = person->next) {
  1914.       if (!IS_NPC(person)) {
  1915.         count++;
  1916.         if (IS_IMMORTAL(person)) {
  1917.           if (person->desc == NULL) {
  1918.         lcount++;
  1919.           } else {
  1920.         sprintf(buf, "%s %s\n\r", GET_NAME(person), (person->player.title?person->player.title:"(null)"));
  1921.         send_to_char(buf,ch);
  1922.           }
  1923.         }
  1924.       }
  1925.     }
  1926.       }
  1927.     }
  1928.     if (listed == 0) {
  1929.       sprintf(buf, "\n\rTotal players / Link dead [%d/%d] (%2.0f%%)\n\r",
  1930.           count,lcount,((float)lcount / (int)count) * 100);
  1931.       send_to_char(buf, ch);
  1932.     } else {
  1933.       sprintf(buf, "\n\rTotal players / Link dead [%d/%d] (%2.0f%%) Number Listed: %d\n\r",
  1934.           count,lcount,((float)lcount / (int)count) * 100,listed);
  1935.       send_to_char(buf, ch);
  1936.     }
  1937.   }
  1938. }
  1939.  
  1940. void do_users(struct char_data *ch, char *argument, int cmd)
  1941. {
  1942.   char buf[MAX_STRING_LENGTH], line[200], buf2[255];
  1943.   extern const char *connected_types[];
  1944.  
  1945.   struct descriptor_data *d;
  1946.   
  1947.   strcpy(buf, "Connections:\n\r------------\n\r");
  1948.   
  1949.   for (d = descriptor_list; d; d = d->next){
  1950.       if (d->character && d->character->player.name){
  1951.       if(d->original)
  1952.         sprintf(line, "%-16s: ", d->original->player.name);
  1953.       else
  1954.         sprintf(line, "%-16s: ", d->character->player.name);
  1955.     }
  1956.       else
  1957.     sprintf(line, "UNDEFINED       : ");
  1958.       if (d->host && *d->host) {
  1959.     sprintf(buf2, "%-22s [%s]\n\r", connected_types[d->connected],d->host);
  1960.       } else {
  1961.     sprintf(buf2, "%-22s [%s]\n\r", connected_types[d->connected],"????");
  1962.       }
  1963.      strcat(line, buf2);
  1964.      strcat(buf, line);
  1965.     }
  1966.   send_to_char(buf, ch);
  1967. }
  1968.  
  1969.  
  1970.  
  1971. void do_inventory(struct char_data *ch, char *argument, int cmd) {
  1972.   
  1973.   send_to_char("You are carrying:\n\r", ch);
  1974.   list_obj_in_heap(ch->carrying, ch);
  1975. }
  1976.  
  1977.  
  1978. void do_equipment(struct char_data *ch, char *argument, int cmd) {
  1979.   int j,Worn_Index;
  1980.   bool found;
  1981.   char String[256];
  1982.   
  1983.   send_to_char("You are using:\n\r", ch);
  1984.   found = FALSE;
  1985.   for (Worn_Index = j=0; j< MAX_WEAR; j++) {
  1986.     if (ch->equipment[j]) {
  1987.       Worn_Index++;
  1988.       sprintf(String,"[%d] %s",Worn_Index,where[j]);
  1989.       send_to_char(String,ch);
  1990.       if (CAN_SEE_OBJ(ch,ch->equipment[j])) {
  1991.     show_obj_to_char(ch->equipment[j],ch,1);
  1992.     found = TRUE;
  1993.       } else {
  1994.     send_to_char("Something.\n\r",ch);
  1995.     found = TRUE;
  1996.       }
  1997.     }
  1998.   }
  1999.   if(!found) {
  2000.     send_to_char(" Nothing.\n\r", ch);
  2001.   }
  2002. }
  2003.  
  2004.  
  2005. void do_credits(struct char_data *ch, char *argument, int cmd) {
  2006.   
  2007.   page_string(ch->desc, credits, 0);
  2008. }
  2009.  
  2010.  
  2011. void do_news(struct char_data *ch, char *argument, int cmd) {
  2012.   
  2013.   page_string(ch->desc, news, 0);
  2014. }
  2015.  
  2016.  
  2017. void do_info(struct char_data *ch, char *argument, int cmd) {
  2018.   
  2019.   page_string(ch->desc, info, 0);
  2020. }
  2021.  
  2022.  
  2023. void do_wizlist(struct char_data *ch, char *argument, int cmd) {
  2024.   
  2025.   page_string(ch->desc, wizlist, 0);
  2026. }
  2027.  
  2028. int which_number_mobile(struct char_data *ch, struct char_data *mob)
  2029. {
  2030.   struct char_data    *i;
  2031.   char    *name;
  2032.   int    number;
  2033.   
  2034.   name = fname(mob->player.name);
  2035.   for (i=character_list, number=0; i; i=i->next) {
  2036.     if (isname(name, i->player.name) && i->in_room != NOWHERE) {
  2037.       number++;
  2038.       if (i==mob)
  2039.     return number;
  2040.     }
  2041.   }
  2042.   return 0;
  2043. }
  2044.  
  2045. char *numbered_person(struct char_data *ch, struct char_data *person)
  2046. {
  2047.   static char buf[MAX_STRING_LENGTH];
  2048.   if (IS_NPC(person) && IS_IMMORTAL(ch)) {
  2049.     sprintf(buf, "%d.%s", which_number_mobile(ch, person),
  2050.         fname(person->player.name));
  2051.   } else {
  2052.     strcpy(buf, PERS(person, ch));
  2053.   }
  2054.   return buf;
  2055. }
  2056.  
  2057. void do_where_person(struct char_data *ch, struct char_data *person, struct string_block *sb)
  2058. {
  2059.   char buf[MAX_STRING_LENGTH];
  2060.   
  2061.   sprintf(buf, "%-30s- %s ", PERS(person, ch),
  2062.       (person->in_room > -1 ? real_roomp(person->in_room)->name : "Nowhere"));
  2063.   
  2064.   if (GetMaxLevel(ch) >= LOW_IMMORTAL)
  2065.     sprintf(buf+strlen(buf),"[%d]", person->in_room);
  2066.   
  2067.   strcpy(buf+strlen(buf), "\n\r");
  2068.   
  2069.   append_to_string_block(sb, buf);
  2070. }
  2071.  
  2072. void do_where_object(struct char_data *ch, struct obj_data *obj,
  2073.                 int recurse, struct string_block *sb)
  2074. {
  2075.   char buf[MAX_STRING_LENGTH];
  2076.   if (obj->in_room != NOWHERE) { /* object in a room */
  2077.     sprintf(buf, "%-30s- %s [%d]\n\r",
  2078.         obj->short_description,
  2079.         real_roomp(obj->in_room)->name,
  2080.         obj->in_room);
  2081.   } else if (obj->carried_by != NULL) { /* object carried by monster */
  2082.     sprintf(buf, "%-30s- carried by %s\n\r",
  2083.         obj->short_description,
  2084.         numbered_person(ch, obj->carried_by));
  2085.   } else if (obj->equipped_by != NULL) { /* object equipped by monster */
  2086.     sprintf(buf, "%-30s- equipped by %s\n\r",
  2087.         obj->short_description,
  2088.         numbered_person(ch, obj->equipped_by));
  2089.   } else if (obj->in_obj) { /* object in object */
  2090.     sprintf(buf, "%-30s- in %s\n\r",
  2091.         obj->short_description,
  2092.         obj->in_obj->short_description);
  2093.   } else {
  2094.     sprintf(buf, "%-30s- god doesn't even know where...\n\r",
  2095.         obj->short_description);
  2096.   }
  2097.   if (*buf)
  2098.     append_to_string_block(sb, buf);
  2099.   
  2100.   if (recurse) {
  2101.     if (obj->in_room != NOWHERE)
  2102.       return;
  2103.     else if (obj->carried_by != NULL)
  2104.       do_where_person(ch, obj->carried_by, sb);
  2105.     else if (obj->equipped_by != NULL)
  2106.       do_where_person(ch, obj->equipped_by, sb);
  2107.     else if (obj->in_obj != NULL)
  2108.       do_where_object(ch, obj->in_obj, TRUE, sb);
  2109.   }
  2110. }
  2111.  
  2112. void do_where(struct char_data *ch, char *argument, int cmd)
  2113. {
  2114.   char name[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH];
  2115.   char    *nameonly;
  2116.   register struct char_data *i;
  2117.   register struct obj_data *k;
  2118.   struct descriptor_data *d;
  2119.   int    number, count;
  2120.   struct string_block    sb;
  2121.   
  2122.   only_argument(argument, name);
  2123.   
  2124.   if (!*name) {
  2125.     if (GetMaxLevel(ch) < LOW_IMMORTAL)          {
  2126.       send_to_char("What are you looking for?\n\r", ch);
  2127.       return;
  2128.     } else     {
  2129.       init_string_block(&sb);
  2130.       append_to_string_block(&sb, "Players:\n\r--------\n\r");
  2131.       
  2132.       for (d = descriptor_list; d; d = d->next) {
  2133.     if (d->character && (d->connected == CON_PLYNG) && (d->character->in_room != NOWHERE)) {
  2134.       if (d->original)   /* If switched */
  2135.         sprintf(buf, "%-20s - %s [%d] In body of %s\n\r",
  2136.             d->original->player.name,
  2137.             real_roomp(d->character->in_room)->name,
  2138.             d->character->in_room,
  2139.             fname(d->character->player.name));
  2140.       else
  2141.         sprintf(buf, "%-20s - %s [%d]\n\r",
  2142.             d->character->player.name,
  2143.             real_roomp(d->character->in_room)->name,
  2144.             d->character->in_room);
  2145.       
  2146.       append_to_string_block(&sb, buf);
  2147.     }
  2148.       }
  2149.       page_string_block(&sb,ch);
  2150.       destroy_string_block(&sb);
  2151.       return;
  2152.     }
  2153.   }
  2154.   
  2155.   if (isdigit(*name)) {
  2156.     nameonly = name;
  2157.     count = number = get_number(&nameonly);
  2158.   } else {
  2159.     count = number = 0;
  2160.   }
  2161.   
  2162.   *buf = '\0';
  2163.   
  2164.   init_string_block(&sb);
  2165.   
  2166.   for (i = character_list; i; i = i->next)
  2167.     if (isname(name, i->player.name) && CAN_SEE(ch, i) )       {
  2168.       if ((i->in_room != NOWHERE) &&
  2169.       ((GetMaxLevel(ch)>=LOW_IMMORTAL) || (real_roomp(i->in_room)->zone ==
  2170.                          real_roomp(ch->in_room)->zone))) {
  2171.     if (number==0 || (--count) == 0) {
  2172.       if (number==0) {
  2173.         sprintf(buf, "[%2d] ", ++count); /* I love short circuiting :) */
  2174.         append_to_string_block(&sb, buf);
  2175.       }
  2176.       do_where_person(ch, i, &sb);
  2177.       *buf = 1;
  2178.       if (number!=0)
  2179.         break;
  2180.     }
  2181.            if (GetMaxLevel(ch) < LOW_IMMORTAL)
  2182.       break;
  2183.       }
  2184.     }
  2185.   
  2186.   /*  count = number;*/
  2187.   
  2188.   if (GetMaxLevel(ch) >= LOW_IMMORTAL ) {
  2189.     for (k = object_list; k; k = k->next)
  2190.       if (isname(name, k->name) && CAN_SEE_OBJ(ch, k)) {
  2191.     if (number==0 || (--count)==0) {
  2192.       if (number==0) {
  2193.         sprintf(buf, "[%2d] ", ++count);
  2194.         append_to_string_block(&sb, buf);
  2195.       }
  2196.       do_where_object(ch, k, number!=0, &sb);
  2197.       *buf = 1;
  2198.       if (number!=0)
  2199.         break;
  2200.     }
  2201.       }
  2202.   }
  2203.   
  2204.   if (!*sb.data)
  2205.     send_to_char("Couldn't find any such thing.\n\r", ch);
  2206.   else
  2207.     page_string_block(&sb, ch);
  2208.   destroy_string_block(&sb);
  2209. }
  2210.  
  2211.  
  2212.  
  2213.  
  2214. void do_levels(struct char_data *ch, char *argument, int cmd)
  2215. {
  2216.   int i, RaceMax, class;
  2217.   char buf[MAX_STRING_LENGTH];
  2218.   char buf2[MAX_STRING_LENGTH];
  2219.   
  2220.   extern const struct title_type titles[MAX_CLASS][ABS_MAX_LVL];
  2221.   
  2222.   if (IS_NPC(ch))    {
  2223.     send_to_char("You ain't nothin' but a hound-dog.\n\r", ch);
  2224.     return;
  2225.   }
  2226.   
  2227.   *buf = '\0';
  2228. /*
  2229. **  get the class
  2230. */
  2231.  
  2232.   for (;isspace(*argument);argument++);
  2233.  
  2234.   if (!*argument) {
  2235.     send_to_char("You must supply a class!\n\r", ch);
  2236.     return;
  2237.   }
  2238.  
  2239.   switch(*argument) {
  2240.   case 'C':
  2241.   case 'c':
  2242.   case 'P':
  2243.   case 'p':
  2244.     class = CLERIC_LEVEL_IND;
  2245.     break;
  2246.   case 'F':
  2247.   case 'f':
  2248.   case 'W':
  2249.   case 'w':
  2250.     class = WARRIOR_LEVEL_IND;
  2251.     break;
  2252.   case 'M':
  2253.   case 'm':
  2254.     class = MAGE_LEVEL_IND;
  2255.     break;
  2256.   case 'T':
  2257.   case 't':
  2258.     class = THIEF_LEVEL_IND;
  2259.     break;
  2260.   case 'D':
  2261.   case 'd':
  2262.     class = DRUID_LEVEL_IND;
  2263.     break;
  2264.   case 'K':
  2265.   case 'k':
  2266.     class = MONK_LEVEL_IND;
  2267.     break;
  2268.  
  2269.   default:
  2270.     sprintf(buf, "I don't recognize %s\n\r", argument);
  2271.     send_to_char(buf,ch);
  2272.     return;
  2273.     break;
  2274.   }
  2275.  
  2276.   RaceMax = RacialMax[GET_RACE(ch)][class];
  2277.   
  2278.   for (i = 1; i <= RaceMax; i++) {
  2279.     
  2280.     sprintf(buf, "[%2d] %9d-%-9d : %s\n\r", i,
  2281.         titles[class][i].exp,
  2282.         titles[class][i + 1].exp, (GET_SEX(ch)==SEX_FEMALE?titles[class][i].title_f:titles[class][i].title_m));
  2283.     
  2284.     send_to_char(buf, ch);
  2285.   }
  2286. }
  2287.  
  2288.  
  2289.  
  2290. void do_consider(struct char_data *ch, char *argument, int cmd)
  2291. {
  2292.   struct char_data *victim;
  2293.   char name[256], buf[256];
  2294.   int diff;
  2295.   
  2296.   only_argument(argument, name);
  2297.   
  2298.   if (!(victim = get_char_room_vis(ch, name))) {
  2299.     send_to_char("Consider killing who?\n\r", ch);
  2300.     return;
  2301.   }
  2302.   
  2303.   if (victim == ch) {
  2304.     send_to_char("Easy! Very easy indeed!\n\r", ch);
  2305.     return;
  2306.   }
  2307.   
  2308.   if (!IS_NPC(victim)) {
  2309.     send_to_char("Would you like to borrow a cross and a shovel?\n\r", ch);
  2310.     return;
  2311.   }
  2312.  
  2313.   act("$n looks at $N", FALSE, ch, 0, victim, TO_NOTVICT);
  2314.   act("$n looks at you", FALSE, ch, 0, victim, TO_VICT);
  2315.  
  2316.  
  2317.   diff =  GET_AVE_LEVEL(victim) - GET_AVE_LEVEL(ch);
  2318.   if (diff <= -10)
  2319.     send_to_char("Too easy to be believed.\n\r", ch);
  2320.   else if (diff <= -5)
  2321.     send_to_char("Not a problem.\n\r", ch);
  2322.   else if (diff <= -3)
  2323.     send_to_char("Rather easy.\n\r",ch);
  2324.   else if (diff <= -2)
  2325.     send_to_char("Easy.\n\r", ch);
  2326.   else if (diff <= -1)
  2327.     send_to_char("Fairly easy.\n\r", ch);
  2328.   else if (diff == 0)
  2329.     send_to_char("The perfect match!\n\r", ch);
  2330.   else if (diff <= 1)
  2331.     send_to_char("You would need some luck!\n\r", ch);
  2332.   else if (diff <= 2)
  2333.     send_to_char("You would need a lot of luck!\n\r", ch);
  2334.   else if (diff <= 3)
  2335.     send_to_char("You would need a lot of luck and great equipment!\n\r", ch);
  2336.   else if (diff <= 5)
  2337.     send_to_char("Do you feel lucky, punk?\n\r", ch);
  2338.   else if (diff <= 10)
  2339.     send_to_char("Are you crazy?  Is that your problem?\n\r", ch);
  2340.   else if (diff <= 30)
  2341.     send_to_char("You ARE mad!\n\r", ch);
  2342.   else
  2343.     send_to_char("Why don't I just kill you right now and save you the trouble?\n\r", ch);
  2344.   
  2345.   if (ch->skills) {
  2346.     int skill=0;
  2347.     int learn=0;
  2348.     int num, num2;
  2349.     float fnum;
  2350.  
  2351.     if (IsAnimal(victim) && ch->skills[SKILL_CONS_ANIMAL].learned) {
  2352.       skill = SKILL_CONS_ANIMAL;
  2353.       learn = ch->skills[skill].learned;
  2354.       act("$N seems to be an animal", FALSE, ch, 0, victim, TO_CHAR);
  2355.     }
  2356.     if (IsVeggie(victim) && ch->skills[SKILL_CONS_VEGGIE].learned) {
  2357.       if (!skill)
  2358.     skill = SKILL_CONS_VEGGIE;
  2359.       learn = MAX(learn, ch->skills[SKILL_CONS_VEGGIE].learned);
  2360.       act("$N seems to be an ambulatory vegetable", 
  2361.       FALSE, ch, 0, victim, TO_CHAR);
  2362.     }
  2363.     if (IsDiabolic(victim) && ch->skills[SKILL_CONS_DEMON].learned) {
  2364.       if (!skill)
  2365.     skill = SKILL_CONS_DEMON;
  2366.       learn = MAX(learn, ch->skills[SKILL_CONS_DEMON].learned);
  2367.       act("$N seems to be a demon!", FALSE, ch, 0, victim, TO_CHAR);
  2368.     }
  2369.     if (IsReptile(victim) && ch->skills[SKILL_CONS_REPTILE].learned) {
  2370.       if (!skill)
  2371.     skill = SKILL_CONS_REPTILE;
  2372.       learn = MAX(learn, ch->skills[SKILL_CONS_REPTILE].learned);
  2373.       act("$N seems to be a reptilian creature", 
  2374.       FALSE, ch, 0, victim, TO_CHAR);
  2375.     }
  2376.     if (IsUndead(victim) && ch->skills[SKILL_CONS_UNDEAD].learned) {
  2377.       if (!skill)
  2378.     skill = SKILL_CONS_UNDEAD;
  2379.       learn = MAX(learn, ch->skills[SKILL_CONS_UNDEAD].learned);
  2380.       act("$N seems to be undead", FALSE, ch, 0, victim, TO_CHAR);
  2381.     }
  2382.  
  2383.     if (IsGiantish(victim)&& ch->skills[SKILL_CONS_GIANT].learned) {
  2384.       if (!skill)
  2385.     skill = SKILL_CONS_GIANT;
  2386.       learn = MAX(learn, ch->skills[SKILL_CONS_GIANT].learned);
  2387.       act("$N seems to be a giantish creature", FALSE, ch, 0, victim, TO_CHAR);
  2388.     }
  2389.     if (IsPerson(victim) && ch->skills[SKILL_CONS_PEOPLE].learned) {
  2390.       if (!skill)
  2391.     skill = SKILL_CONS_PEOPLE;
  2392.       learn = MAX(learn, ch->skills[SKILL_CONS_PEOPLE].learned);
  2393.       act("$N seems to be a human or demi-human", 
  2394.       FALSE, ch, 0, victim, TO_CHAR);
  2395.     }
  2396.     if (IsOther(victim)&& ch->skills[SKILL_CONS_OTHER].learned) {
  2397.       if (!skill)
  2398.     skill = SKILL_CONS_OTHER;
  2399.       learn = MAX(learn, ch->skills[SKILL_CONS_OTHER].learned/2);
  2400.       act("$N seems to be a monster you know about", 
  2401.       FALSE, ch, 0, victim, TO_CHAR);
  2402.     }
  2403.  
  2404.     if (learn > 95) learn = 95;
  2405.  
  2406.     if (learn == 0) return;
  2407.  
  2408.     WAIT_STATE(ch, PULSE_VIOLENCE*2);
  2409.  
  2410.     num = GetApprox(GET_MAX_HIT(victim), learn);
  2411.     fnum = ((float)num/(float)GET_MAX_HIT(ch));
  2412.  
  2413.     sprintf(buf, "Est Max hits are: %s\n\r", DescRatio(fnum));
  2414.     send_to_char(buf, ch);
  2415.  
  2416.     num = GetApprox(GET_AC(victim), learn);
  2417.     fnum = ((float)num/(float)GET_AC(ch));
  2418.  
  2419.     sprintf(buf, "Est. armor class is : %s\n\r", DescRatio(fnum));
  2420.     send_to_char(buf, ch);
  2421.  
  2422.     if (learn > 60) {
  2423.       sprintf(buf, "Est. # of attacks: %s\n\r", 
  2424.           DescAttacks(GetApprox((int)victim->mult_att, 
  2425.                    learn)));
  2426.       send_to_char(buf, ch);
  2427.     }
  2428.     if (learn > 70) {
  2429.  
  2430.       num =   GetApprox((int)victim->specials.damnodice, 
  2431.             learn);
  2432.       num2 =  GetApprox((int)victim->specials.damsizedice, 
  2433.             learn);
  2434.  
  2435.       fnum = (float)num*(num2/2.0);
  2436.       sprintf(buf, "Est. damage of attacks is %s\n\r", 
  2437.           DescDamage(fnum));
  2438.             
  2439.       send_to_char(buf, ch);
  2440.     }
  2441.  
  2442.     if (learn > 80) {
  2443.       
  2444.       num =   GetApprox(GET_HITROLL(victim), learn);
  2445.       num2 =  21 - CalcThaco(ch);
  2446.       if (num2 > 0)
  2447.     fnum = ((float)num/(float)num2);
  2448.       else
  2449.     fnum = 2.0;
  2450.  
  2451.       sprintf(buf, "Est. Thaco: %s\n\r", DescRatio(fnum));
  2452.         
  2453.       send_to_char(buf, ch);
  2454.  
  2455.       num =   GetApprox(GET_DAMROLL(victim), learn);
  2456.       num2 =  GET_DAMROLL(ch);
  2457.       fnum = (num/(float)num2);
  2458.  
  2459.       sprintf(buf, "Est. Dam bonus is: %s\n\r", DescRatio(fnum));
  2460.  
  2461.       send_to_char(buf, ch);
  2462.     }
  2463.   }
  2464.  
  2465. }
  2466.  
  2467. void do_spells(struct char_data *ch, char *argument, int cmd)
  2468. {
  2469.   int spl, i;
  2470.   char buf[16384];
  2471.   extern char *spells[];
  2472.   extern int spell_status[];
  2473.   extern struct spell_info_type spell_info[MAX_SKILLS];
  2474.   
  2475.   if (IS_NPC(ch))    {
  2476.     send_to_char("You ain't nothin' but a hound-dog.\n\r", ch);
  2477.     return;
  2478.   }
  2479.   
  2480.   *buf=0;
  2481.  
  2482.   for (i = 1, spl = 0; i <= MAX_EXIST_SPELL; i++, spl++) { 
  2483.     if (GetMaxLevel(ch) > LOW_IMMORTAL || 
  2484.     spell_info[i].min_level_cleric < ABS_MAX_LVL)
  2485.       sprintf(buf + strlen(buf),
  2486.           "[%2d] %-20s  Mana: %3d, Cl: %2d, Mu: %2d, Dr: %2d\n\r",
  2487.           i, spells[spl], 
  2488.           spell_info[i].min_usesmana, 
  2489.           spell_info[i].min_level_cleric, 
  2490.           spell_info[i].min_level_magic,
  2491.           spell_info[i].min_level_druid);
  2492.   }
  2493.   strcat(buf, "\n\r");
  2494.   page_string(ch->desc, buf, 1);
  2495. }
  2496.  
  2497. void do_world(struct char_data *ch, char *argument, int cmd)
  2498. {
  2499.   static char buf[100];
  2500.   long ct, ot;
  2501.   char *tmstr, *otmstr;
  2502.   extern long Uptime;
  2503.   extern long room_count;
  2504.   extern long mob_count;
  2505.   extern long obj_count;
  2506.  
  2507.   sprintf(buf, "Base Source: SillyMUD Version %s.\n", VERSION);
  2508.   send_to_char(buf, ch);
  2509.   ot = Uptime;
  2510.   otmstr = asctime(localtime(&ot));
  2511.   *(otmstr + strlen(otmstr) - 1) = '\0';
  2512.   sprintf(buf, "Start time was: %s (EST)\n\r", otmstr);
  2513.   send_to_char(buf, ch);
  2514.   
  2515.   ct = time(0);
  2516.   tmstr = asctime(localtime(&ct));
  2517.   *(tmstr + strlen(tmstr) - 1) = '\0';
  2518.   sprintf(buf, "Current time is: %s (EST)\n\r", tmstr);
  2519.   send_to_char(buf, ch);
  2520. #if HASH  
  2521.   sprintf(buf, "Total number of rooms in world: %d\n\r", room_db.klistlen);
  2522. #else
  2523.   sprintf(buf, "Total number of rooms in world: %d\n\r", room_count);
  2524. #endif
  2525.   send_to_char(buf, ch);
  2526.   sprintf(buf, "Total number of zones in world: %d\n\r\n\r",
  2527.       top_of_zone_table + 1);
  2528.   send_to_char(buf, ch);
  2529.   sprintf(buf,"Total number of distinct mobiles in world: %d\n\r",
  2530.       top_of_mobt + 1);
  2531.   send_to_char(buf, ch);
  2532.   sprintf(buf,"Total number of distinct objects in world: %d\n\r\n\r",
  2533.       top_of_objt + 1);
  2534.   send_to_char(buf, ch);
  2535.   sprintf(buf,"Total number of registered players: %d\n\r",top_of_p_table + 1);
  2536.   send_to_char(buf, ch);
  2537.  
  2538.   sprintf(buf, "Total number of monsters in game: %d\n\r", mob_count);
  2539.   send_to_char(buf, ch);
  2540.  
  2541.   sprintf(buf, "Total number of objects in game: %d\n\r", obj_count);
  2542.   send_to_char(buf, ch);
  2543.  
  2544. }
  2545.  
  2546. void do_attribute(struct char_data *ch, char *argument, int cmd)
  2547. {
  2548.   char buf[MAX_STRING_LENGTH];
  2549.   struct affected_type *aff;
  2550.  
  2551.   struct time_info_data my_age;
  2552.  
  2553.  
  2554.   age2(ch, &my_age);
  2555.  
  2556.   sprintf(buf,
  2557.       "You are %d years and %d months, %d cms, and you weigh %d lbs.\n\r",
  2558.       my_age.year, my_age.month,
  2559.       ch->player.height,
  2560.       ch->player.weight);
  2561.  
  2562.   send_to_char(buf, ch);
  2563.   
  2564.   sprintf(buf, "You are carrying %d lbs of equipment.\n\r",
  2565.       IS_CARRYING_W(ch));
  2566.   send_to_char(buf, ch); 
  2567.   
  2568.   sprintf(buf,"You are %s \n\r",ArmorDesc(ch->points.armor));
  2569.   send_to_char(buf,ch);
  2570.   
  2571.   if ((GetMaxLevel(ch) > 15) || (HasClass(ch, CLASS_MAGIC_USER))) {
  2572.     if ((GET_STR(ch)==18) && (HasClass(ch, CLASS_WARRIOR))) {
  2573.        sprintf(buf,"You have %d/%d STR, %d INT, %d WIS, %d DEX, %d CON, %d CHR\n\r",
  2574.         GET_STR(ch), GET_ADD(ch), GET_INT(ch), GET_WIS(ch), GET_DEX(ch), GET_CON(ch), GET_CHR(ch));
  2575.        send_to_char(buf,ch);
  2576.      } else {
  2577.        sprintf(buf,"You have %d STR %d INT %d WIS %d DEX %d CON %d CHR\n\r",
  2578.         GET_STR(ch), GET_INT(ch), GET_WIS(ch), GET_DEX(ch), GET_CON(ch),
  2579.            GET_CHR(ch));
  2580.        send_to_char(buf,ch);
  2581.     }
  2582.   }  
  2583.  
  2584.   sprintf(buf, "Your hit bonus and damage bonus are %s and %s respectively.\n\r",
  2585.       HitRollDesc(GET_HITROLL(ch)), DamRollDesc(GET_DAMROLL(ch)));
  2586.   send_to_char(buf, ch);
  2587.  
  2588.   /*
  2589.   **   by popular demand -- affected stuff
  2590.   */
  2591.   send_to_char("\n\rAffecting Spells:\n\r--------------\n\r", ch);
  2592.   if (ch->affected) {
  2593.     for(aff = ch->affected; aff; aff = aff->next) {
  2594.       if (aff->type < 170) {
  2595.     switch(aff->type) {
  2596.     case SKILL_SNEAK:
  2597.     case SPELL_POISON:
  2598.     case SPELL_CURSE:
  2599.       break;
  2600.     default:
  2601.       sprintf(buf, "Spell : '%s'\n\r",spells[aff->type-1]);
  2602.       send_to_char(buf, ch);
  2603.       break;
  2604.     }
  2605.       }
  2606.     }
  2607.   }
  2608. }
  2609.  
  2610. void do_value(struct char_data *ch, char *argument, int cmd)
  2611. {
  2612.   char buf[100],buf2[100], name[100];
  2613.   struct obj_data *obj=0;
  2614.   struct char_data *vict=0;
  2615.  
  2616.   /* Spell Names */
  2617.  
  2618.   
  2619.   /* For Objects */
  2620.   extern char *item_types[];
  2621.   extern char *extra_bits[];
  2622.   extern char *apply_types[];
  2623.   extern char *affected_bits[];
  2624.   extern char *affected_bits2[];
  2625.   extern char *immunity_names[];
  2626.  
  2627.  
  2628.   if (!HasClass(ch, CLASS_THIEF)) {
  2629.     send_to_char("Sorry, you can't do that here", ch);
  2630.     return;
  2631.   }
  2632.   
  2633.   argument = one_argument(argument, name);
  2634.  
  2635.   if ((obj = get_obj_in_list_vis(ch, name, ch->carrying))==0) {    
  2636.     if ((vict = get_char_room_vis(ch, name))==0) {
  2637.       send_to_char("Who, or what are you talking about?\n\r", ch);
  2638.       return;
  2639.     } else {
  2640.       only_argument(argument, name);
  2641.       if ((obj = get_obj_in_list_vis(ch, name, vict->carrying))==0) {
  2642.     act("You can't see that on $M", FALSE, ch, obj, vict, TO_CHAR);
  2643.     act("$n looks you over", FALSE, ch, 0, vict, TO_VICT);
  2644.     act("$n looks $N over", FALSE, ch, 0, vict, TO_NOTVICT);
  2645.     return;
  2646.       }
  2647.     }
  2648.   }
  2649.  
  2650.   WAIT_STATE(ch, PULSE_VIOLENCE*2);
  2651.  
  2652.   if (!SpyCheck(ch)) {  /* failed spying check */
  2653.     if (obj && vict) {
  2654.       act("$n looks at you, and $s eyes linger on $p",
  2655.       FALSE, ch, obj, vict, TO_VICT);
  2656.       act("$n studies $N", 
  2657.       FALSE, ch, 0, vict, TO_ROOM);
  2658.       
  2659.     } else if (obj) {
  2660.       act("$n intensely studies $p", FALSE, ch, obj, 0, TO_ROOM);
  2661.     } else{
  2662.       return;
  2663.     }
  2664.   }
  2665.  
  2666.  
  2667.   sprintf(buf, "Object: %s.  Item type: ", obj->short_description);
  2668.   sprinttype(GET_ITEM_TYPE(obj),item_types,buf2);
  2669.   strcat(buf,buf2); strcat(buf,"\n\r");
  2670.   send_to_char(buf, ch);
  2671.  
  2672.   if (!ch->skills) return;
  2673.  
  2674.   
  2675.   if (number(1,101) < ch->skills[SKILL_EVALUATE].learned/3) {
  2676.     if (obj->obj_flags.bitvector) {
  2677.       send_to_char("Item will give you following abilities:  ", ch);
  2678.       sprintbit((unsigned long)obj->obj_flags.bitvector,affected_bits,buf);
  2679.       strcat(buf,"\n\r");
  2680.       send_to_char(buf, ch);
  2681.     }
  2682.   }
  2683.    
  2684.   if (number(1,101) < ch->skills[SKILL_EVALUATE].learned/2) {
  2685.     send_to_char("Item is: ", ch);
  2686.     sprintbit((unsigned long) obj->obj_flags.extra_flags,extra_bits,buf);
  2687.     strcat(buf,"\n\r");
  2688.     send_to_char(buf,ch);
  2689.   }
  2690.  
  2691.   sprintf(buf,"Weight: %d, Value: %d, Rent cost: %d  %s\n\r",
  2692.         obj->obj_flags.weight, 
  2693.       GetApprox(obj->obj_flags.cost, 
  2694.             ch->skills[SKILL_EVALUATE].learned-10), 
  2695.       GetApprox(obj->obj_flags.cost_per_day, 
  2696.             ch->skills[SKILL_EVALUATE].learned-10), 
  2697.       obj->obj_flags.cost_per_day>LIM_ITEM_COST_MIN?"[RARE]":" ");
  2698.   send_to_char(buf, ch);
  2699.  
  2700.   if (ITEM_TYPE(obj) == ITEM_WEAPON) {
  2701.     sprintf(buf, "Damage Dice is '%dD%d'\n\r",
  2702.         GetApprox(obj->obj_flags.value[1],
  2703.               ch->skills[SKILL_EVALUATE].learned-10),
  2704.         GetApprox(obj->obj_flags.value[2],
  2705.               ch->skills[SKILL_EVALUATE].learned-10));
  2706.     send_to_char(buf, ch);
  2707.   } else if (ITEM_TYPE(obj) == ITEM_ARMOR) {
  2708.  
  2709.       sprintf(buf, "AC-apply is %d\n\r",
  2710.           GetApprox(obj->obj_flags.value[0],
  2711.             ch->skills[SKILL_EVALUATE].learned-10));
  2712.       send_to_char(buf, ch);
  2713.   }  
  2714. }
  2715.  
  2716. char *AlignDesc(int a)
  2717. {
  2718.   if (a <= -900) {
  2719.     return("Really really bad");
  2720.   } else if (a <= -500) {
  2721.     return("Not nice at all");
  2722.   } else if (a <= -351) {
  2723.     return("obnoxious as hell");
  2724.   } else if (a <= -100) {
  2725.     return("just plain annoying");
  2726.   } else if (a <= 100) {
  2727.     return("You feel balanced");
  2728.   } else if (a <= 350) {
  2729.     return("Polite");
  2730.   } else if (a <= 500) {
  2731.     return("Sweet, caring, all that BS.");
  2732.   } else if (a <= 900) {
  2733.     return("A real goody-goody");
  2734.   } else{
  2735.     return("So good it makes you sick");
  2736.   }
  2737. }
  2738.  
  2739.  
  2740. char *ArmorDesc(int a)
  2741. {
  2742.   if (a >= 90) {
  2743.     return("barely armored");
  2744.   } else if (a >= 50) { 
  2745.     return("Lightly armored");
  2746.   } else if (a >= 30) {
  2747.     return("Medium-armored");
  2748.   } else if (a >= 10) {
  2749.     return("Fairly well armored");
  2750.   } else if (a >= -10) {
  2751.     return("Well armored");
  2752.   } else if (a >= -30) {
  2753.     return("Quite well armored");
  2754.   } else if (a >= -50) {
  2755.     return("Very well armored");
  2756.   } else if (a >= -90) {
  2757.     return("Extremeley well armored");
  2758.   } else {
  2759.     return("armored like a tank");
  2760.   }
  2761. }
  2762.  
  2763. char *HitRollDesc(int a)
  2764. {
  2765.   if (a < -5) {
  2766.     return("Quite bad");
  2767.   } else if (a < -1) {
  2768.     return("Pretty lousy");
  2769.   } else if (a <= 1) {
  2770.     return("Not Much of one");
  2771.   } else if (a < 3) {
  2772.     return("Not bad");
  2773.   } else if (a < 8) {
  2774.     return("Damn good");
  2775.   } else {
  2776.     return("Very good");
  2777.   }
  2778. }
  2779.  
  2780. char *DamRollDesc(int a)
  2781. {
  2782.   if (a < -5) {
  2783.     return("Quite bad");
  2784.   } else if (a < -1) {
  2785.     return("Pretty lousy");
  2786.   } else if (a <= 1) {
  2787.     return("Not Much of one");
  2788.   } else if (a < 3) {
  2789.     return("Not bad");
  2790.   } else if (a < 8) {
  2791.     return("Damn good");
  2792.   } else {
  2793.     return("Very good");
  2794.   }
  2795. }
  2796.  
  2797. char *DescRatio(float f)  /* theirs / yours */
  2798. {
  2799.   if (f > 1.0) {
  2800.     return("More than twice yours");
  2801.   } else if (f > .75) {
  2802.     return("More than half again greater than yours");
  2803.   } else if (f > .6) {
  2804.     return("At least a third greater than yours");
  2805.   } else if (f > .4) {
  2806.     return("About the same as yours");
  2807.   } else if (f > .3) {
  2808.     return("A little worse than yours");
  2809.   } else if (f > .1) {
  2810.     return("Much worse than yours");
  2811.   } else {
  2812.     return("Extremely inferior");
  2813.   }  
  2814. }
  2815.  
  2816. char *DescDamage(float dam)
  2817. {
  2818.   if (dam < 1.0) {
  2819.     return("Minimal Damage");
  2820.   } else if (dam <= 2.0) {
  2821.     return("Slight damage");
  2822.   } else if (dam <= 4.0) {
  2823.     return("A bit of damage");
  2824.   } else if (dam <= 10.0) {
  2825.     return("A decent amount of damage");
  2826.   } else if (dam <= 15.0) {
  2827.     return("A lot of damage");
  2828.   } else if (dam <= 25.0) {
  2829.     return("A whole lot of damage");
  2830.   } else if (dam <= 35.0) {
  2831.     return("A very large amount");
  2832.   } else {
  2833.     return("A TON of damage");
  2834.   }
  2835. }
  2836.  
  2837. char *DescAttacks(float a)
  2838. {
  2839.   if (a < 1.0) {
  2840.     return("Not many");
  2841.   } else if (a < 2.0) {
  2842.     return("About average");
  2843.   } else if (a < 3.0) {
  2844.     return("A few");
  2845.   } else if (a < 5.0) {
  2846.     return("A lot");
  2847.   } else if (a < 9.0) {
  2848.     return("Many");
  2849.   } else {
  2850.     return("A whole bunch");
  2851.   }
  2852. }
  2853.  
  2854.  
  2855. void do_display(struct char_data *ch, char *arg, int cmd)
  2856. {
  2857.  int i;
  2858.  
  2859.  if(IS_NPC(ch))
  2860.     return;
  2861.  
  2862.  i = atoi(arg);
  2863.  
  2864.  switch(i) {
  2865.  case 0: if(ch->term == 0) {
  2866.             send_to_char("Display unchanged.\n\r", ch);
  2867.             return;
  2868.       }
  2869.           ch->term = 0;
  2870.           ScreenOff(ch);
  2871.           send_to_char("Display now turned off.\n\r", ch);
  2872.           return;
  2873.  
  2874.  case 1: if(ch->term == 1) {
  2875.             send_to_char("Display unchanged.\n\r", ch);
  2876.             return;
  2877.        }
  2878.           ch->term = VT100;
  2879.           InitScreen(ch);
  2880.           send_to_char("Display now set to VT100.\n\r", ch);
  2881.           return;
  2882.  
  2883.  default: if(ch->term == VT100) {
  2884.             send_to_char("Term type is currently VT100.\n\r", ch);
  2885.             return;
  2886.       }
  2887.           send_to_char("Display is currently OFF.\n\r", ch);
  2888.           return;
  2889.  }
  2890. }
  2891.  
  2892. void ScreenOff(struct char_data *ch)
  2893. {
  2894.  char buf[255];
  2895.  
  2896.  sprintf(buf, VT_MARGSET, 0, ch->size- 1);
  2897.  send_to_char(buf, ch);
  2898.  send_to_char(VT_HOMECLR, ch);
  2899. }
  2900.  
  2901. void do_resize(struct char_data *ch, char *arg, int cmd)
  2902. {
  2903.  int i;
  2904.  
  2905.  if(IS_NPC(ch))
  2906.    return;
  2907.  
  2908.  i = atoi(arg);
  2909.  
  2910.  if(i < 7) {
  2911.     send_to_char("Screen size must be greater than 7.\n\r", ch);
  2912.     return;
  2913.   }
  2914.  
  2915.  ch->size = i;
  2916.  
  2917.  if(ch->term == VT100) {
  2918.     ScreenOff(ch);
  2919.     InitScreen(ch);
  2920.   }
  2921.  
  2922.  send_to_char("Ok.\n\r", ch);
  2923.  return;
  2924. }
  2925.